Time of Update: 2018-12-04
對於顯式 Intent,Android不需要去做解析,因為目標組件已經很明確,Android需要解析的是那些隱式Intent,通過解析,將 Intent映射給可以處理此Intent的Activity、IntentReceiver或Service。 Intent解析機制主要是通過尋找登入在
Time of Update: 2018-12-04
Android NDK對於我們的作用和基本常識在 Android NDK開發技巧一 中已經講明了,今天談論下實戰的技巧吧 1. 在JNI中列印Logcat,首先我們需要在cpp檔案中加入 #include <android/log.h> 這個標頭檔,NDK有關android自己的就給我們這個唯一的檔案log.h,其他的需要我們自己hack diy來解決。 jstring jlog; //從Java傳來需要列印的字元 jboolean isCopy; const char *
Time of Update: 2018-12-04
1.有關JNI的類型方法表示,很多網友不明白,下面Android開發網就,基本上C層面的類型均是j+java過去的類型,比如字串在JNI的c層面為jstring而Java為String,對於布爾類型boolean則為jboolean對應Java中的boolean。 2. 有關Java類的表示在JNI中對應關係如下 long cwjInfo (int nAge, String sName, int[] arrSalary); 我們可以表示為 "(ILjava/lang/String;
Time of Update: 2018-12-04
主要講解下昨天需要詳細說明有關JavaJNI相關的異常處理、安全執行緒問題,在JNI中產生的異常主要是記憶體不足OutOfMemoryError、數組越界ArrayIndexOutOfBoundsException、數組賦實值型別錯誤ArrayStoreException以及指標越界等問題。簡單的我們昨天在 Android JNI開發提高篇中已經講到。
Time of Update: 2018-12-04
android:theme="@android:style/Theme.Dialog" : Activity顯示為對話方塊模式android:theme="@android:style/Theme.NoTitleBar" : 不顯示應用程式標題欄android:theme="@android:style/Theme.NoTitleBar.Fullscreen" : 不顯示應用程式標題欄,並全屏android:theme="Theme.Light ":
Time of Update: 2018-12-04
ConnectivityManager mConnectivity = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);TelephonyManager mTelephony = (TelephonyManager)this.getSystemService(TELEPHONY_SERVICE);//檢查網路連接,如果無網路可用,就不需要進行連網操作等 NetworkInfo info =
Time of Update: 2018-12-04
一、啟動SIM連絡人匯入手機 INTENT// SIM import Intent importIntent = new Intent(Intent.ACTION_VIEW); importIntent.setType("vnd.android.cursor.item/sim-contact");
Time of Update: 2018-12-04
xml的反編譯在apk中的xml檔案是經過壓縮的,可以通過AXMLPrinter2工具解開,具體命令為:java -jar AXMLPrinter2.jar AndroidManifest.xml找到Android軟體安裝包中的class.dex:把apk檔案改名為.zip,然後解壓縮其中的class.dex檔案,它就是java檔案編譯再通過dx工具打包成的。 工具準備:1、把dex檔案反編譯為jar檔案的工具。(dex2jar)http://code.google.com/p/dex2jar/
Time of Update: 2018-12-04
/* * How To Write Faster Loops (after Dan Bornstein, Google Engineer) */ /* 1 ( 最快 ) */for (int i = initializer; i >= 0; i--) { ... } /* 2 第二*/int limit = calculateLoopLimit(); for (int i = 0; i < limit; i++) { ... } /* 3 */Type[]
Time of Update: 2018-12-04
如何自訂Android菜單背景呢? 預設的情況下Android系統的菜單是白色的,下面的例子可以通過自訂的xml布局實現個人化的menupublic class MenuEx extends Activity { private static final String TAG = "android123"; @Override public void onCreate(Bundle savedInstanceState) {
Time of Update: 2018-12-04
代碼:private MediaPlayer mediaPlayer;mediaPlayer =MediaPlayer.create(context,R.drawable.XXX); Runnable rmp = new Runnable() { public void run() { mediaPlayer01.start(); }};//然後 :final Thread tmp = new Thread(rmp);//再在適當的地方:tmp.start()
Time of Update: 2018-12-04
在這裡, 我將每種動畫分別應用於四個按鈕為例: (1) main.xml 代碼如下:(聲明四個按鈕控制項)XML代碼:<?xml version="1.0"
Time of Update: 2018-12-04
The AndroidManifest.xml File <activityandroid:windowSoftInputMode=["stateUnspecified", "stateUnchanged", "stateHidden", "stateAlwaysHidden", "stateVisible",
Time of Update: 2018-12-04
Time of Update: 2018-12-04
android:launchMode="singleTask" 和 onNewIntent(Intent intent)兩個特性,現總結一下經驗:android:launchMode="singleTask" 配置在 Mainifest 中,它保證了棧中此Activity總是只有一個,無論你啟動它多少次;onNewIntent(Intent intent) 是Override
Time of Update: 2018-12-04
1、android與本機伺服器(同一台電腦)通迅,必須為電腦添加一個IP: 10.0.0.2,否則無法串連上本機伺服器。 2、伺服器接收端 這裡就不寫了 直接在model裡面設定要獲到的屬性名稱字就行,如要接收 title,就直接用this.model.getTitle(); 3、用戶端(發送端) public void httpPost2(){try{show.setText(" post2 "+new Date().toString());//
Time of Update: 2018-12-04
在進行android開發時,每個Activity會預設帶上一個title bar用以顯示程式名,有時為了擴大螢幕的顯示地區需要去掉這個title bar,去掉螢幕上的title bar有3個方法,第一個方法是在代碼去掉title bar在Activity的onCreate中加入如下代碼:Java代碼
Time of Update: 2018-12-04
通過Android系統提供的介面,可以很方便的管理連絡人資訊。一、添加1、新增連絡人...1.6上的代碼:String peopleName = "name";ContentValues personValues = new ContentValues();// namepersonValues.put(Contacts.People.NAME, peopleName);/* STARRED 0 = Contacts, 1 = Favorites
Time of Update: 2018-12-04
1.從google搜尋內容Intent intent = new Intent();intent.setAction(Intent.ACTION_WEB_SEARCH);intent.putExtra(SearchManager.QUERY,"searchString")startActivity(intent);2.瀏覽網頁Uri uri = Uri.parse("http://www.google.com");Intent it = new
Time of Update: 2018-12-04
main.xml:<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"