1.動態(tài)創(chuàng)建WebView時傳入Application的Context會導致網(wǎng)頁無法彈出下拉框。如下所示:
WebView webview=new WebView(getApplicationContext);
2.多進程下避免使用SharedPreferences共享數(shù)據(jù),即使是使用MODE_MULTI_PROCESS
模式。事實上,這已經(jīng)被廢棄了,
3.避免在使用Iterator 遍歷集合的時候去操作集合,如add,remove。典型例子如下:
4.Android5.0之后啟動Service必須顯示聲明Intent,否則將報錯Service Intent must be explicit
,正確方式如下:
Intent intent=new Intent("com.demo.aidlservice");
bindService(intent,mServiceConnection,Context.BIND_AUTO_CREATE);
5.在啟動模式是singleTask
和singleInstance
的Activity中使用startActivityForResult
時,在5.0及以上的系統(tǒng)中可以成功在onActivityResult
中獲取返回值,在5.0以下會出現(xiàn)異常。
6.查看簽名證書信息(MD5,SHA-1)
keytool -list -v -keystore filepath
7.隱藏軟鍵盤
InputMethodManager im= (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
im.hideSoftInputFromWindow(view.getWindowToken(),0);
有任何疑問,歡迎加群討論:261386924