1.動(dòng)態(tài)創(chuàng)建WebView時(shí)傳入Application的Context會(huì)導(dǎo)致網(wǎng)頁無法彈出下拉框。如下所示:
WebView webview=new WebView(getApplicationContext);
2.多進(jìn)程下避免使用SharedPreferences共享數(shù)據(jù)斥滤,即使是使用MODE_MULTI_PROCESS
模式。事實(shí)上,這已經(jīng)被廢棄了,
3.避免在使用Iterator 遍歷集合的時(shí)候去操作集合,如add征绸,remove。典型例子如下:
4.Android5.0之后啟動(dòng)Service必須顯示聲明Intent俄占,否則將報(bào)錯(cuò)Service Intent must be explicit
,正確方式如下:
Intent intent=new Intent("com.demo.aidlservice");
bindService(intent,mServiceConnection,Context.BIND_AUTO_CREATE);
5.在啟動(dòng)模式是singleTask
和singleInstance
的Activity中使用startActivityForResult
時(shí)管怠,在5.0及以上的系統(tǒng)中可以成功在onActivityResult
中獲取返回值,在5.0以下會(huì)出現(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