USB模式打開
小米3:
設(shè)置---關(guān)于手機(jī)---連續(xù)點(diǎn)擊MIUI版本6次,打開開發(fā)者選項(xiàng)------返回設(shè)置---找到其他高級設(shè)置,點(diǎn)擊進(jìn)入--開發(fā)者選項(xiàng)---操作即可。
root打開: adb root
開發(fā)常見問題:
Activity全屏,軟鍵盤擋住輸入框問題的終極解決方案:
EditText問題:
1 進(jìn)入Activity時,EditText不自動獲取焦點(diǎn):
在EditText的容器Linearlayout(Relativelayout)中添加屬性
android:focusableInTouchMode="true"
2 代碼清除焦點(diǎn):
et.clearFocus();
ShareSDK開發(fā):
1 拷貝文件
拷貝libs到目錄
拷貝Sharesdk.xml文件到assets目錄下
2 初始化
調(diào)用
鬧鐘攜帶數(shù)據(jù)對象丟失的問題:
問題描述:
使用AlarmManager啟動鬧鐘時,使用PendingIntent攜帶數(shù)據(jù),
在BroadcastReceiver解析數(shù)據(jù)時,發(fā)現(xiàn)數(shù)據(jù)為空。
解決辦法:
把實(shí)體類轉(zhuǎn)化成byte[],添加到Bundle中,然后再添加到Intent中,最后使用PendingIntent攜帶數(shù)據(jù)
在接收端BroadcastReceiver,取出byte[],然后將其轉(zhuǎn)化為實(shí)體類對象即可。
參考文章:
Be Careful Where You Use Custom Parcelables
Android 7.0 BroadcastReceiver接收pendingIntent 傳遞過來序列化數(shù)據(jù)
Android通知欄多條通知沖突的問題
莫名崩潰時異常排查方法:
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable ex) {
MobclickAgent.reportError(getApplicationContext(), ex);
android.os.Process.killProcess(android.os.Process.myPid());
}
});
將以上代碼加入Application,Debug斷點(diǎn)查看異常堆棧信息,即可獲取異常的類名和方法名