In the learning process will encounter some problems, and solve it.
1, Problem one
toon device ‘emulator-5554‘: timeout
Workaround:
window->preferences->Android->DDMS->ADB connection time out (ms): 将这个值设置的大一些,默认为5000,设置成200000。
2, question two
android.os.NetworkOnMainThreadException
Workaround:
Version issue, in4.0After the main thread in the execution of HTTP requests will be reported this error, the network to find the corresponding solution, in OnCreate () add the following two lines of code: Strictmode. Setthreadpolicy(New Strictmode. Threadpolicy. Builder(). Detectdiskreads(). Detectdiskwrites(). Detectnetwork(). Penaltylog(). Build());Strictmode. Setvmpolicy(New Strictmode. Vmpolicy. Builder(). Detectleakedsqlliteobjects(). Detectleakedclosableobjects(). Penaltylog(). Penaltydeath(). Build());
3. Question Three
android.content.res.Resources$NotFoundExceptionString#0xa
Workaround:
TextView 在使用方法是,添加入setText的不是String类型ageText.setText(userinfo.getUser_age());Int-->string方法一:ageText.setText(userinfo.getUser_age()+"");方法二:在UserInfo中定义User_age是定义为Integer,然后ageText.setText(userinfo.getUser_age()。toString());
4. Question Four
java.lang.IllegalArgumentException:‘_id‘not exist
Workaround:
这个是在使用SimpleCursorAdapter 适配器时,适配器在组装数据的时候,Cursor数据中没有"_id"这一列。关于例子,[适配器部分代码可以看到](http://blog.csdn.net/qq_17326933/article/details/48015251**user_id as _id** ,user_name as name,user_age as age from user_info",null);
Is the simplecursoradapter of the father of the CursorAdapter source of the explanation
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android: Learning Notes (ii)