Time of Update: 2018-12-04
拿到android項目,是一個apk的包。這裡麵包含編譯後的代碼和資源檔兩部分。其中資源檔的反向工程,可以參見簡單分析apk檔案中的資訊。而編譯後的代碼部分,需要藉助兩個工具:dex2jar,用於將dex檔案轉換為jar檔案; jd-gui,將jar檔案反向工程為java代碼。 dex2jar的連結在:http://code.google.com/p/dex2jar/下載然後解壓縮,可以直接在windows下或者linux下運行。命令參數比較簡單:./dex2jar.sh
Time of Update: 2018-12-04
In android, we can highlight the button through custom images. Here is a example that will give you about how to set a image when the button is focused, pressed and focused pressed. we can set each image for each stage.Example for Android Button
Time of Update: 2018-12-04
Android裡有兩個類 android.view.GestureDetector android.view.GestureDetector.SimpleOnGestureListener (另外android.widget.Gallery好像是更牛x的OnGestureListener ) 1) 建立一個類繼承SimpleOnGestureListener,HahaGestureDetectorListener 可以實現以下event事件。 boolean
Time of Update: 2018-12-04
private List<ResolveInfo> mApps; private void loadApps() { Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); mApps =
Time of Update: 2018-12-04
在命令列輸入: emulator -help,即可顯示emulator支援的所有命令。Android Emulator usage: emulator [options] [-qemu args] options: -sysdir <dir> 在目錄<dir>中搜尋system.img -system <file> 讀取system.img檔案<file>
Time of Update: 2018-12-04
1. 判斷是否有可用網路 public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ConnectivityManager mConnectivityManager = (ConnectivityManager)
Time of Update: 2018-12-04
private class SpeechView extends LinearLayout { private TextView mTitle; private TextView mDialogue;public SpeechView(Context context, String title, String words) { super(context); this.setOrientation(VERTICAL);
Time of Update: 2018-12-04
很多網友不明白如何在Android平台上捕獲Back鍵的事件,Back鍵是手機上的後退鍵,一般的軟體不捕獲相關資訊可能導致你的程式被切換到後台,而回到案頭的尷尬情況,在Android上有兩種方法來擷取該按鈕的事件。 1.直接擷取按鈕按下事件,此方法相容Android 1.0到Android 2.1 也是常規方法,直接重寫Activity的onKeyDown方法即可,代碼如下:@Overridepublic boolean onKeyDown(int keyCode, KeyEvent
Time of Update: 2018-12-04
在一個Activity中,多次調用startActivity()來啟動另一個Activity,要想只產生一個Activity執行個體,方法有兩種。 方法一:設定起動模式 一個Activity有四種啟動模式:standard, singleTop, singleTask, singleInstance。 standard: 標準模式,一調用startActivity()方法就會產生一個新的執行個體。 singleTop: 如果已經有一個執行個體位於Activity棧的頂部時,就不產生新的執行個體,
Time of Update: 2018-12-04
1、開啟命令視窗 點擊“開始”--->"運行"----> 輸入cmd,斷行符號21、進入android sdk 1.5的目錄,輸入如下的命令列: mksdcard 100M D:/sdcardxy.img 其中,100M是sdcard的大小, D:/sdcardxy.img 是sdcard在硬碟中的存放位置3、在當前的路徑下輸入如下的命令啟動模擬器並掛載剛配置好的sdcard: emulator -sdcard D:/sdcardxy.img -
Time of Update: 2018-12-04
1.大量查詢資料庫時cursor沒有關閉錯誤寫法: Cursor cursor = getContentResolver().query( ); if(cursor != null){ cursor.moveTOFirst(); while(!cursor.isAfterLast()) { .............. }} 正確寫法:Cursor cursor = getContentResolver().query(
Time of Update: 2018-12-04
In android, we can scroll the elements in both horizontal and vertical format. To scroll in Vertical we can use Scrollview, to scroll in horizontal format we need to use HorizontalScrollview.Example for HorizontalScrollview :-01<?xml version="1.0"
Time of Update: 2018-12-04
昨天我們在Android遊戲開發之旅三 View詳解中提到了onDraw方法,有關詳細的實現我們今天主要說下Android的Canvas和Paint對象的使用執行個體。 Canvas類主要實現了螢幕的繪製過程,其中包含了很多實用的方法,比如繪製一條路徑、地區、貼圖、畫點、畫線、渲染文本,下面是Canvas類常用的方法,當然Android開發網提示大家很多方法有不同的重載版本,參數更靈活。 void drawRect(RectF rect, Paint paint)
Time of Update: 2018-12-04
Java代碼 public void onCreate(Bundle icicle) { super.onCreate(icicle); LinearLayout linLayout = new LinearLayout(this); // 載入需要操作的圖片,這裡是eoeAndroid的logo圖片 Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),
Time of Update: 2018-12-04
dex2jar 和 JD-GUI 這2個工具是學習android的好幫手 dex2jar : http://laichao.googlecode.com/files/dex2jar-0.0.7-SNAPSHOT.zip JD-GUI: windows版JD-GUI: http://laichao.googlecode.com/files/jdgui.zip linux版JD-GUI:
Time of Update: 2018-12-04
1、通過布局指定要顯示的內容:tabs.xml<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:id=
Time of Update: 2018-12-04
傳統UI開發中,如果背景的大小不一樣,一般需要為每種大小都製作一張圖片,這在button中尤為明顯。當然我們也可以一小塊一小塊水平重複的畫,也可以垂直的話。在android中專門有一種叫nine patch圖片(以 9.png結尾)來解決背景大小不一樣時,只用一張背景圖片。 用內建的tools/draw9patch.bat
Time of Update: 2018-12-04
在移動互連網的爭奪日趨白熱化,各個互連網巨頭紛紛推出自己的手機瀏覽器,瀏覽器市場的爭奪從案頭轉移到了手機。在Android手機中內建了一款高效能webkit核心瀏覽器,在SDK中封裝為一個叫做WebView組件。什麼是webkitWebKit是Mac OS X v10.3及以上版本所包含的軟體架構(對v10.2.7及以上版本也可通過軟體更新擷取)。同時,WebKit也是Mac OS
Time of Update: 2018-12-04
[功能] 1. ViewFlipper 可以包含多個View 且View之間的切換有Animation 比如:漸層效果 [代碼] 1. 建立包含ViewFlipper 的main.xml 還包含2個Button 用於各個View切換Java代碼 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
Time of Update: 2018-12-04
線上程中通過Handler開啟 ProgressDialog的時候,出現如下的異常:W/WindowManager( 584): Attempted to add window with non-application token WindowToken{436ee690 token=null}. Aborting.D/AndroidRuntime(21543): Shutting down VMW/dalvikvm(21543): threadid=3: thread exiting