Time of Update: 2018-12-05
http://www.cnblogs.com/melaniedeng/archive/2012/05/17/2506869.html 做Android應用的人都知道,要一個apk適用多個不同的手機螢幕是很容易的,就是在項目的res檔案夾下面有多套相關的資源檔。程式啟動並執行時候,Android系統會根據當前裝置的資訊去載入不同檔案夾下的資源檔。但是Android系統是怎麼做到這一點的呢?上網上搜了一下,很少有這方便的介紹,只好自己研究下代碼了。下面是我研究代碼得到的結果(正確性有待確認
Time of Update: 2018-12-05
引起crashpublic class MainActivity extends Activity {Button click2Crash; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Log.i("Thread0",
Time of Update: 2018-12-05
可以修改SDK 的 image 檔案,讓這些image 直接到自己編譯的image 目錄下面,這樣可以在模擬器中直接運行自己修改、編譯的image 檔案了。 在修改代碼之後,要執行 make sdk 來編譯產生新的SDK。 我使用的android 的版本是 1.6 的,故做如下修改使得模擬器所用的image 為編譯產生的image。 1. 到 android-sdk-windows/platforms/android-1.6 目錄下把 “data", "images",
Time of Update: 2018-12-05
android 在系統crash時往往UI線程會出現問題,這個時間關於介面的映像顯示往往會出現問題,總結了兩種顯示 方法,顯示Toast,或者跳轉Activity顯示ToastLooper.prepare();Toast.makeText(mContext, Message.CLOSE_FOR_UNEXPECTED_REASON, Toast.LENGTH_LONG).show();Looper.loop();關於Activity的跳轉Intent startMain = new Intent(
Time of Update: 2018-12-05
private void killProcess(Context mAct) { // TODO Auto-generated method stub Log.i(TAG, "killProcess"); String packageName = mAct.getPackageName(); String processId = ""; try { Runtime r =
Time of Update: 2018-12-05
Android 子項目列表, the list is from : http://android.git.kernel.org/ To clone one of these trees, install git, and run:git clone git://android.git.kernel.org/ + project path. To clone the entire platform, install repo, and run:mkdir mydroidcd
Time of Update: 2018-12-05
許多情況下,我們要獲得指定檔案的Uri,費話不多說直接上代碼:通過已知路徑來獲得audio檔案的uri/** * 尋找在於SDcard中的Audio檔案對應於MediaStore 的uri * @param file 音頻檔案 * @return */public Uri queryUriforAudio(File file){final String where = MediaStore.Audio.Media.DATA +
Time of Update: 2018-12-05
TextView 多行時,我選擇用WebView替換,寫一個Css,見代碼 Html<html><head><title>Test</title></head><body><div style="text-align:center; background-color:red;font-size:10px;color:blue"><span style="margin:0 auto;width:100px;"
Time of Update: 2018-12-05
下面的方法前提是你能獲得root許可權。我用的是小米手機, 上面的Calender程式感覺沒什麼。但是那是系統內建的程式沒辦刪除。於是我通過想到root後的命令列操作cmd #進入命令列adb remount #重寫分區命令,讓你的可讀許可權變為可寫cd /system/app/ #進入到安裝的應用檔案夾下ls -l #查看當前的檔案rm Cale* #刪除所有以Cale開頭的程式ls -l #查看當前的檔案
Time of Update: 2018-12-05
android的Face Service目前為上(4.2)只能進行人臉的識別,而不能進行人臉的對比。下面是具體代碼package com.example.facedetectdemo;import java.io.IOException;import android.app.Activity;import android.content.pm.ActivityInfo;import android.graphics.PixelFormat;import
Time of Update: 2018-12-05
1. 安裝 java 6 - sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse" - sudo apt-get update - sudo apt-get install sun-java6-jdk - sudo update-alternatives --config java 2. 安裝其他的程式包 sudo apt-get
Time of Update: 2018-12-05
uboot 在初始化結束之後,會調用 start_kernel 來運行linux kernel. 剛剛簡單的看了看kernel 3.4, 現在的kernel是採用建立核心線程的形式來運行 init 的。 具體的代碼可以參考 linux kernel 代碼中的 init/main.c start_kernel -> rest_init , 在 rest_init 中建立了核心線程, 這個線程的處理函數是 init_post, 在 init_post 中系統會調用
Time of Update: 2018-12-05
由於 android 在編譯的過程中,使用了Werror 的選項,那麼任何warning 都會當作錯誤來處理。在編譯 android 4.0 (IceCreamSandwith) 的時候,由於使用的編譯器中可能內建了 _FORITY_SOUCE 這個宏,在編譯 android 代碼的時候,會發生錯誤。這個問題在 android 的known issue 中有列 (http://source.android.com/source/known-issues.html),解決方案可以參考:https:
Time of Update: 2018-12-05
public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView v= null; v.setText("abc");
Time of Update: 2018-12-05
Android 的編譯環境設定是通過 build/envsetup.sh 來完成的。 - croot: Changes directory to the top of the tree. - m: Makes from the top of the tree. - mm: Builds all of the modules in the current directory. - mmm: Builds all of the modules
Time of Update: 2018-12-05
aes : AES 一種密碼編譯演算法 apache-http : Apache 基金的一個java 版本的 HTTP 操作介面 bison : 文法產生器 bluez : 藍芽的編程介面 bsddiff : BSD diff bzip2 : bzip clearsilver
Time of Update: 2018-12-05
文章目錄 Build Variants Android build target list.make sdk - build the tools that are part of an SDK (adb, fastboot, etc.)make snod - build the system image from the current software binariesmake servicesmake runtimemake
Time of Update: 2018-12-05
自己添加的一個新項目在編譯過程中發現 sytem.ima 檔案大小超標,網上已經有很多接這個問題的方法 (修改 BOARD_SYSTEMIMAGE_PARTITION_SIZE 的尺寸, BOARD_USERDATAIMAGE_PARTITION_SIZE ), 仔細的看看發現 system.img 編譯成了 ext4 而不是 yaffs2,查看了一下 build 系統的Makefile。1. 在 buildi/core/Makefile 中有如下的代碼,如果
Time of Update: 2018-12-05
1. andriod 代碼層次 |-- Makefile : 系統的 Makefile |-- bionic : C 庫函數的替代品 |-- bootable : 和引導相關的代碼 |-- build : 是編譯和配置所需要的指令碼和工具 |-- dalvik : java 虛擬機器 |-- development : 程式開發所需要的模板和工具 |-- external : 用的外部的開源的擴充庫,編譯產生在目錄 /lib |
Time of Update: 2018-12-05
Android 項目是由很多子項目組成,你可以通過repo init -u git://android.git.kernel.org/platform/manifest.gitrepo sync來下載整個項目,也可以直接用 git clone 來直接下載某一個子項目。git clone git://android.git.kernel.org/ + project path. Android