Android debug summary
来源:互联网 发布:淘宝助手怎么用 编辑:程序博客网 时间:2024/05/01 20:30
1. Download bin to phone fail
Already installed the usb driver ,but download bin to phone fail. The prompt like"xxx COM5 xxx error...", it maybe caused by COM port conflict with other APP or other driver. So you can change the COM num to unused num to resolve this problem. such like change COM5to COM50.
2. App force close or occur fatal error.
Analysis the dump file, search the "exception" keyword in dump_state_xxx dump file. And you can see one line contained the keyword like "Fatal main", bellow the searched line, you can see the call stack, and the place where cause the force close.
3. Checkbox have no touch tone.
Maybe this is Android platform's bug. when tap the checkbox icon, there is no touch tone. I have checked the source code, found that even if there have implemented the onClickListener of the view, when touch the view will play touch tone. Button and listview all use view.onClickListener listen the key event.But Checkbox use CompoundButton.OnCheckedChangeListener listen key event, so when touch the checkbox icon, viewclass invoke onKeyUp to handle the key event ,in this callback function checked that the onClickListener is null, so not play the touch tone. If you want your checkbox have touch tone, you should addview.playSoundEffect(int) in your own implementedonCheckedChanged()function of your CompoundButton.OnCheckedChangeListener.
4. UI thread blocked
Can't refresh UI component in other thread except UI thread.Service runs in UI thread, so should not do much time-consuming operation in Service component, such as connect with network waitting for server response or download data, this can block the UI thread, and make a bad user feel.
5. Caution null database pointer
db = SQLiteDatabase.openOrCreateDadabase(); may return null pointer because the database not create or open normally. So before use the db pointer, check whether the db is null or not is usefull. And after use of an opened database shouldfinally closethe database.
db = SQLiteDatabase.openOrCreateDadabase(); try{if(db == null || db.isOpen() == false) return;db.execSQL();}catch(SQLException e){}finally{if(db != null) db.close();}
6. Reference maybe different which returned in the different time
getSharedPreferences().edit().putString();getSharedPreferences().edit().commit();
line1 and line2 are point to different object, because getSharedPreferences().edit() willcreate a new Editer, getSharedPreferences().edit() be called twice so ganerate two different object. That cause the error, line1 and line2 operate to different object. theright code should be write as below:
SharedPreferences sprfs = getSharedPreferences().edit();//first get the original referencesprfs.putString();sprfs.commit();
7. Caution use equals method
equals must be used between same type object, if you compare different type of object, that's will cause error. Be caution!!! the wrong code like below:
EditText.getText().equals(String);
The right code should be as below:
EditText.getText().toString().equals(String);
8. String array maybe invalidate after system language changed
If system language is English, When string array created, it's content are consistent English. When the language change to Chinese, if not recreate the string array, it's content is still English, this will cause string displayed not according to the current language, cause error. To avoid this issue, when switch language , should recreate the string array. Normally, destroy the string array in onDestroy and recreate the string array in onCreate.
9. Exception in catch
there already occur out array bound excepton in try, but also not check the array bound in catch. What the hell...
10. build android4.0 occur java version error
build android4.0 and android2.3 need different java version, the android4.0 maybe need jdk1.6.0_25 version. If build android4.0 occur this error, please first check java version.
when installed new jdk version should change the jdk path in .bashrc, then run . ~/.bashrc to make the modify effective .
- Android debug summary
- CSR8811 bluetooth debug summary
- android webview summary
- android touch event summary
- Android Service Summary
- summary of android tutorials
- Android animation summary
- android-skill-summary
- Android RingtonePreference 显示副标题 summary
- Android 应用 日程助手 summary
- Android 7.0 Settings Summary 小记
- android debug
- android debug
- android debug
- android debug
- Android Debug
- android debug
- Android Debug
- 心轮是让你感受到心念的冷暖,
- scanf中的正则表达式
- CSS中hack和注释书写规范
- etc/rc.d目录下的介绍
- jquery处理滚动条事件
- Android debug summary
- Android的设置界面及Preference使用
- JSP/Servlet设置编码格式的问题
- 深入浅出WPF学习(一)
- Hibernate高级映射 --- 组件映射
- android NFC开发实例
- iPhone网络开发
- java学习:内部类和异常
- [环球] 出发!目标拉萨----争取每日更新!!