Time of Update: 2018-12-05
大體思路,首先Bitmap.createBitmap建立位元影像,然後自訂函數drawIntoBitmap,最後通過onDraw建立畫布來實現繪製的位元影像package com.example;import java.io.InputStream;import android.app.Activity;import android.content.Context;import android.graphics.Bitmap;import
Time of Update: 2018-12-05
其實這個標題沒什麼意思;但是想來想去,自己(新手)查了很多資料才調通,就打算在此一寫。 android-jni的socket編程,就是調用底層linux的socket編程。android平台,一般只需要關心用戶端代碼,如下:(從華清遠見嵌入式linux應用開發教材上copy的,手頭沒好點的例子)/*client.c*/#include <stdio.h>#include <stdlib.h>#include
Time of Update: 2018-12-05
在Android平台下,除了對應用程式的私人檔案夾中的檔案進行操作外,還可以從資源檔和 Assets 中獲得輸入資料流讀取資料,這些檔案分別放在應用程式的res/raw 目錄和 assets 目錄下,這些檔案在編譯的時候和其他檔案一起被打包。 需要注意的是,來自Resources和Assets 中的檔案只可以讀取而不能進行寫的操作,下面就通過一個例子來說明如何從 Resources 和 Assets中的檔案中讀取資訊。首先分別在res/raw 和 assets 目錄下建立兩個文字檔 "
Time of Update: 2018-12-05
在Android應用裡,最耗費記憶體的就是圖片資源。而且在Android系統中,讀取位元影像Bitmap時,分給虛擬機器中的圖片的堆棧大小隻有8M,如果超出了,就會出現OutOfMemory異常。所以,對於圖片的記憶體最佳化,是Android應用開發中比較重要的內容。 1)
Time of Update: 2018-12-05
碼農的風格,直接上代碼。android下判斷一個應用app是否是系統rom整合的方法:import android.app.Activity;import android.content.pm.ApplicationInfo;import android.content.pm.PackageInfo;import android.content.pm.PackageManager.NameNotFoundException;import android.os.Bundle;import
Time of Update: 2018-12-05
轉自
Time of Update: 2018-12-05
今天調用別人的代碼時出現了Can't create handler inside thread that has not called
Time of Update: 2018-12-05
12345678910111213public class ClassPathResource { publicstatic booleanisMobileNO(String mobiles) { Pattern p = Pattern .compile("^((13[0-9])|(15[^4,//D])|(18[0,5-9]))//d{8}$"); Matcher m =
Time of Update: 2018-12-05
今天在寫天氣程式的時候,需要從webservice擷取天氣的狀況,然後載入相應的天氣圖片,伺服器上擷取的是圖片的名字,比如"0.gif",但是程式裡需要設定為為imageView.setImageResource(R.drawable.a_0);這種格式,群友介紹了一個方法int android.content.res.Resources.getIdentifier(String name,String defType, String
Time of Update: 2018-12-05
Chapter 1 ReadingWeb Apps versus Native AppsFirst Web Apps The defining characteristics of a web app are that the user interface (UI) is built with web standard technologies, it is available at a URL (public, private, or perhaps behind a log in),
Time of Update: 2018-12-05
使用ViewPager用使用android的相容包,android-support-v4.jar。工程原始碼下載:點擊下載在res/layout下建立三個檔案first.xml,second.xml,third.xml,隨便加入一些控制項main.xml檔案的布局如下:<?xml version="1.0" encoding="utf-8"?><FrameLayout
Time of Update: 2018-12-05
涉及三個類:MainActiviyt.java 主類FirstAsyncTask.java 繼承 AsyncTask<Void,Void,Void>類NetOperator.java 在非同步線程中執行的操作package com.ken.async;import android.app.Activity;import android.os.Bundle;import android.view.View;import
Time of Update: 2018-12-05
北京時間5月7日訊息,據國外媒體報道,知情人士披露,戴爾正在考慮在將來的產品中採用Google Android作業系統的可行性。 周三,Bsquare Corp公司的一篇宣稱在為戴爾迷你筆記型電腦開發軟體的新聞稿引發了這一傳言。 該公司宣稱,已經找到了一種可以在“運行Google Android平台的戴爾迷你筆記型電腦”上使用Adobe視頻軟體的途徑。
Time of Update: 2018-12-05
BitmapFactory.Options opt = new BitmapFactory.Options(); //這個isjustdecodebounds很重要 opt.inJustDecodeBounds = true; bm = BitmapFactory.decodeFile(absolutePath, opt); //擷取到這個圖片的原始寬度和高度int
Time of Update: 2018-12-05
1. 工程的layout.xml檔案如下:聲明一個TextView控制項和一個Spinner控制項<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"
Time of Update: 2018-12-05
註明:本文轉自http://www.moandroid.com. 原文地址: http://www.moandroid.com/?p=508 XML 經常用作 Internet 上的一種資料格式,其檔案格式想必大家都比較清楚,在這裡我結合Android平台,來說明Android SDK提供的讀寫XML的package。 首先介紹下Android SDK與Java SDK在讀寫XML檔案方面,資料包之間的關係。Android 平台最大的一個優勢在於它利用了 Java
Time of Update: 2018-12-05
xml如下:<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android" android:repeatCount="infinite" android:repeatMode="restart"> <alpha android:fromAlpha="0.0"
Time of Update: 2018-12-05
看一下android2.3的api,如: 從這邊的介紹可以看出,Android2.3 提供了NFC的訪問功能,允許應用讀取NFC tags中的NDEF訊息。 可以看到, Android2.3 新增了android.nfc 這個包。 下面一共就三個類. 實際上, 不止三個類, 還有兩個隱藏類。
Time of Update: 2018-12-05
原文地址:http://developer.android.com/guide/topics/manifest/activity-element.html#lmode 此篇短文是介紹activity是如何被啟動的。有4種模式與Intent對象中的antivity標記一起協同來決定activity被調用時的表現行為。它們是:“standard”“singleTop”“singleTask”“singleInstance”預設是“standard”。 下表所示,上述模式被分為兩類,“standard
Time of Update: 2018-12-05
最近看android資料,隨手寫了個簡單手機瀏覽器應用,該應用很簡單,主要包括AutoCompleteTextView 、WebView、Button控制項,但是涉及到了很多android開發常識,例如:許可權管理、布局標題列狀態列隱藏、開闢線程監聽事件、子線程不能更新主線程UI等,下面介紹一下程式碼範例:1,修改AndroidManifest.xml檔案,首先添加上網和應用旋轉許可權, 如下: <uses-permission