Android: Learning Notes (ii)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.