Time of Update: 2018-12-05
這兩天閑下來,想隨便寫點android程式,突然發現,之前忙了大半年的android,居然連個簡單的遊戲都做不了,看來基礎確實很重要,開始從最實學習。今天研究兩個activity切換,應該用到startActivity(Intent aIntent)。兩個activity儘可能簡單,第一個包含一個button按鈕,點擊按鈕,調用startActivity()進行切換。先看AndroidManifest.xml<?xml version="1.0" encoding="utf-8"?>
Time of Update: 2018-12-05
客戶需要跟蹤運單資訊,決定採用gps和 基站定位。經過幾天的折騰,已粗見成效,以下為範例程式碼: locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); // 建立LocationManager對象provider = locationManager.getBestProvider(getCriteria(), true); //
Time of Update: 2018-12-05
布局:View Code 1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:layout_width="fill_parent" 4 android:layout_height="fill_parent" 5
Time of Update: 2018-12-05
用WifiManager 方式來擷取:public String getIp(){ //擷取wifi服務 WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); //判斷wifi是否開啟 if (!wifiManager.isWifiEnabled()) { wifiManager.setWifiEnabled(true); } WifiInfo wifiInfo =
Time of Update: 2018-12-05
TextView及其子類,當字元內容太長顯示不下時可以省略符號代替未顯示的字元;省略符號可以在顯示地區的起始,中間,結束位置,或者以跑馬燈的方式顯示文字(textview的狀態為被選中)。 其實現只需在xml中對textview的ellipsize屬性做相應的設定即可。 android:ellipsize="start" 省略符號在開頭 android:ellipsize="middle" 省略符號在中間
Time of Update: 2018-12-05
在ListView中設定Selector為null會報null 指標? mListView.setSelector(null);//null 指標 試試下面這種: mListView.setSelector(new
Time of Update: 2018-12-05
動畫類型Android的animation由四種類型組成XML中alpha 漸層透明度動畫效果scale 漸層尺寸伸縮動畫效果translate 畫面轉換位置移動動畫效果rotate 畫面轉移旋轉動畫效果JavaCode中AlphaAnimation 漸層透明度動畫效果ScaleAnimation 漸層尺寸伸縮動畫效果TranslateAnimation 畫面轉換位置移動動畫效果RotateAnimation
Time of Update: 2018-12-05
第一種方法,在代碼裡面直接寫。Java代碼 requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); requestWindowFeature(Window.FEATURE_NO_TITLE);
Time of Update: 2018-12-05
1.啟動程式無需動畫Java代碼 myIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);//1.5的應該使用,這樣就可以沒有動畫效果了 getWindow().setWindowAnimations(1)//1.6的應該使用,這不要忘記放在activity 2.SD卡建立目錄Java代碼
Time of Update: 2018-12-05
在你理解和使用 Android Cursor 的時候你必須Crowdsourced Security Testing道關於 Cursor 的幾件事情:Cursor 是每行的集合。使用 moveToFirst() 定位第一行。你必須知道每一列的名稱。你必須知道每一列的資料類型。Cursor 是一個隨機的資料來源。所有的資料都是通過下標取得。關於 Cursor 的重要方法:close() 關閉遊標,釋放資源copyStringToBuffer(int columnIndex,
Time of Update: 2018-12-05
1. Download a specific version:repo init -u git://android.git.kernel.org/platform/manifest.git -b android-2.3.4_r1repo init -u git://android.git.kernel.org/platform/manifest.git -b froyo 2. Download protocol:You can use both the the git:// or the
Time of Update: 2018-12-05
轉載自:http://intrepidusgroup.com/insight/2010/09/android-root-source-code-looking-at-the-c-skills/ Root Andoid現在主要是依靠兩個漏洞:init進程的udev和adbd進程的setuid,下面是詳細描述。之前的文章提到的rageagainstthecage這個程式利用的是setuid這個漏洞。這兩個漏洞的攻擊程式源碼在這裡:/Files/super119/RageAgainstTheCage.
Time of Update: 2018-12-05
按照Android的文檔,需要添加這樣的udev規則:SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev" 不過需要注意的時候,在發現adb無法發現Android裝置的時候,請注意idVendor字串是否是填成小寫。如之前調試Sharp的裝置,Sharp的vendor
Time of Update: 2018-12-05
From: http://como0925.pixnet.net/blog/post/29390286-%5Bandroid%5D%E9%97%9C%E6%96%BCapp2sd,a2sd,data2sd,a2sd%2B%E4%B9%8B%E9%96%93%E7%9A%84%E5%8D%80%E5%88%A5%E5%92%8C首先解釋一下這些縮寫,全部的意思就是Application To
Time of Update: 2018-12-05
原文:http://www.coding.com.br/android/android-dumpsys/Android has an interesting command called dumpsys to dump some system information. Even described on adb manual I think that some points should be reinforced. In order to get the complete status
Time of Update: 2018-12-05
1. Java層如何列印調用棧?在最佳化Android啟動過程時,同事給出一種列印出調用棧的函數。分享一下 java.util.Map<Thread, StackTraceElement[]> ts = Thread.getAllStackTraces(); StackTraceElement[] ste = ts.get(Thread.currentThread()); for (StackTraceElement s : ste) {
Time of Update: 2018-12-05
1.前言該Demo的分析參考了mapdigit的關於Api Demos的文章,我在他的基礎上更進一步分析了相關知識點。2.Demo效果3.Demo分析 該樣本很簡單,功能只有一個,就是搜尋出所有的音頻檔案,廢話少說,直入主題:先看布局,進入該樣本後只有一個TextView和一個Button屹立著: 點擊”Get
Time of Update: 2018-12-05
1.主要內容本小節介紹onStop與onRestart以及onStart的使用,通過本講我們能學會應該在onStop與onStart裡面執行什麼樣的操作。2.觀看視頻講解http://www.eyeandroid.com/thread-11346-1-1.html3.翻譯參考 停止與重啟Activity 在activity生命週期中,恰當的停止與重啟activity是很重要的,這樣能確保使用者感知到程式的存在並不會丟失他們的進度。在下面一些關鍵的情境中會涉及到停止與重啟:
Time of Update: 2018-12-05
1.Demo說明與示範該Demo介紹如何在Android擷取當前Wallpaper,對Wallpaper做些修改,然後用修改後的映像重新設定Wallpaper,注意要在AndroidMainfest中加許可權<uses-permission android:name="android.permission.SET_WALLPAPER"
Time of Update: 2018-12-05
1.主要內容本小節介紹如何構建一個簡單的使用者介面,包括一個輸入框和一個按鈕。詳細介紹了各個View的屬性值。2.視頻講解http://www.eyeandroid.com/thread-10716-1-1.html3.翻譯參考目錄 1 構建一個簡單的使用者介面1.1 使用線性布局1.2 添加一個文本輸入框1.3 增加字串資源1.4 添加一個按鈕1.5 讓輸入框充滿整個螢幕的寬度構建一個簡單的使用者介面 Android的圖形化使用者介面使用View和ViewGroup的層級類進行建立。View類