Time of Update: 2018-12-04
cannot be cast to
Time of Update: 2018-12-04
不知不覺離這篇博文寫下已經三年了,而我現在也開始供職渣浪Android開發工程師。看看當年的文章,在今天也仍有其指導意義,如果有讀者碰到問題或Bug歡迎提出。我預感我將在Android開發的道路上越走越黑。微博@王彤讓我飛奔過去---------------------------------------------------------------------------------------------假如你還要再等下去,明年這時候,你照樣什麼事都不知道。
Time of Update: 2018-12-04
1. APP啟動時隔三差五地隨機性地CRASH,捕捉到的日誌:----------------2013-06-03 10:26:52----------------#00 pc 0002e9b4 /data/data/com.XXXX.map/lib/libmapengine.so#01 lr 8082dc97 /data/data/com.XXXX.map/lib/libmapengine.so2.
Time of Update: 2018-12-04
ndk版本:android-ndk-r8d,基於ndk內建samples中的test-libstdc++工程進行修改。1. 例子工程目錄結構:test-libstdc++ / jni / Android.mktest-libstdc++ / jni / Application.mktest-libstdc++ / jni / test-libstdc++.cpp2. Android.mk檔案:# A simple test for the minimal standard C++
Time of Update: 2018-12-04
如果listview 的item裡面有button,imagebutton,往往會造成click事件被button截取,而listview的item收不到click事件,通過google,發現需要做兩件事情1 在item的布局中給我們最大的layout設定1個屬性 android:descendantFocusability="blocksDescendants" blocksDescendants:viewgroup會覆蓋子類控制項而直接獲得焦點2
Time of Update: 2018-12-04
情況1:root@ubuntu:/work/android# git clone git://android.git.kernel.org/repo > ~/bin/repoandroid.git.kernel.org[0: 180.168.41.175]: errno=Connection refusedfatal: unable to connect a socket (Connection refused)情況2:root@ubuntu:/work/android# wget
Time of Update: 2018-12-04
我發現我在學習每一個Android介面控制項的時候花的時間都比較多,因為是初學,可能學習方法和方式還有待改進。本篇記錄選項菜單和操作功能表的基本實現和用法。選項菜單即按下手機硬按鍵MENU鍵彈出的底部菜單,最多同時顯示6個小項目,更多將顯示為MORE..點擊到子功能表//添加功能表項目@Overridepublic boolean onCreateOptionsMenu(Menu menu) {// TODO Auto-generated method stubmainmenu =
Time of Update: 2018-12-04
網路上下拉重新整理的代碼一堆一堆的,我這裡就不介紹了。。當執行下拉重新整理時候,會瘋狂調用getview,於是我百度了很多方法,很多說listview的布局要固定大小,改成android:layout_height="fill_parent" android:layout_height="fill_parent"經過測試,失敗了。。。。。。。於是我想到了在代碼裏手動修改listview的大小DisplayMetrics dm = new
Time of Update: 2018-12-04
系統相機調用方法:第一步:Intent bycamera = new Intent("android.media.action.IMAGE_CAPTURE");bycamera.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(yourfilepath));startActivityForResult(bycamera, 0);第二步:在當前Activity的onActivityResult(int, int,
Time of Update: 2018-12-04
基本原理,android系統在點擊了撥號鍵後,會發送一個廣播,action為:Intent.ACTION_NEW_OUTGOING_CALL,我們通過編寫自己的Reciver來接受這個廣播,從intent中取出撥號號碼,達到目的。。。首先我們靜態註冊Reciver<receiver android:name=".Caller" > <intent-filter android:priority="-1" >
Time of Update: 2018-12-04
private Button aBtn = null;//類中聲明初始化1.普通按鈕點擊,為每個控制項新添一個監聽器,使用關鍵字new方便快捷aBtn = (Button) findViewById(R.id.aBtn);aBtn.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View v) {// TODO Auto-generated method stub}});2.實現一個獨立的點擊監聽器類,
Time of Update: 2018-12-04
在Android中,Broadcast是一種廣泛運用的在應用程式之間傳輸資訊的機制。而BroadcastReceiver是對發送出來的 Broadcast進行過濾接受並響應的一類組件。下面將詳細的闡述如何發送Broadcast和使用BroadcastReceiver過濾接收的過程: 首先在需要發送資訊的地方,把要發送的資訊和用於過濾的資訊(如Action、Category)裝入一個Intent對象,然後通過調用 sendOrderBroadcast()或sendStickyBroadcast(
Time of Update: 2018-12-04
得到裝置的物理尺寸,注意,不是解析度!從一個外國的文章上找到的答案http://stackoverflow.com/questions/2193457/is-there-a-way-to-determine-android-physical-screen-height-in-cm-or-inches DisplayMetrics dm = new DisplayMetrics();
Time of Update: 2018-12-04
轉自: http://www.cnblogs.com/dwinter/archive/2012/01/30/2331556.htmlpublic class BitmapCache { static private BitmapCache cache; /** 用於Chche內容的儲存 */ private Hashtable<Integer, MySoftRef> hashRefs; /**
Time of Update: 2018-12-04
使用者在系統的撥號應用中輸入完號碼並且按撥號鍵後,還沒真正撥出去前,我想作一些操作。比如修改號碼或者檢查許可權。 覺得系統的撥號動作應該還是發送一個intent,理論上是可以截獲的。 終於,在開源工程sipUA中看到了方法。如下: 首先,仔細看看API中關於intent.ACTION_NEW_OUTGOING_CALL的描述。寫得很多很詳細,節選一部分“You must hold the PROCESS_OUTGOING_CALLS permission to
Time of Update: 2018-12-04
最近集中在看《Android程式設計》(北航出版社)的圖形使用者介面的相關章節,主要針對自己比較喜歡的UI領域關注一下Android的GUI基礎知識。WebView控制項提供了一個內嵌的瀏覽器試圖,用於顯示本地的html或網路上的網頁。第一步//main.xml<WebView android:id="@+id/html" android:layout_width="fill_parent" android:layout_height="280px"/> 第二步./
Time of Update: 2018-12-04
有網友詢問如何?按下Home鍵的效果,Android裝置在按下Home鍵會自動切換回案頭,其實實現的方法很簡單,由於Launcher捕獲了Home鍵的按下action,我們直接發送個Intent給Launcher即可 Intent i= new Intent(Intent.ACTION_MAIN); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //android123提示如果是服務裡調用,必須加入new
Time of Update: 2018-12-04
在HTC的手機上測試出現 StackOverflowError 的錯誤,找了好長時間終於找到了原因: listView嵌套太深。 我的程式中是這樣的嵌套的: ActivityGroup--->Activity----->LinearLayout---->RelativeLayout----->Listview---->LinearLayout---->TextView解決方案: 改為:
Time of Update: 2018-12-04
ContentProvider主要是提供了我們訪問資料的統一介面,一旦一個類繼承了ContengProvider,我們就會稱這個應用程式為ContengProvider(內容提供者)使用ContentProvider的步驟:1、寫一個類繼承ContentProvider,並改寫其中的一些方法。2、在AndroidManifest.xml檔案中聲明你所定義的provider 在使用ContentProvider之前先要瞭解兩個類的使用:UriMatcher:UriMatcher類用於匹配Uri,它
Time of Update: 2018-12-04
比如通過文檔查看器開啟一個文字檔時,會彈出一個可用來開啟的軟體列表;如何讓自己的軟體也出現在該列表中呢?<activity android:name=".EasyNote" android:label="@string/app_name" android:launchMode="singleTask" android:screenOrientation="portrait"> <intent-filter> <action