1. Error HINT: Your content must has a ListView whose id attribute is ' Android. R.id.list '
For the above error, it may be because we want to implement the Setonitemclick in the ListView of event monitoring to inherit the liseactivity, but there is no listview tag, as long as in the layout file to add custom layout code, When the ListView ID is set to "@android:id/list" or android:id= "@id/android:list", you can use Getlistview to get the ListView object.
The XML code is as follows:
[HTML] View plaincopy <listview
Android:id= "@android: id/list" or android:id= "@id/android:list"
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content" >
</ListView>
2. It is also easy to report this error with Tabhost, as follows:
Question 1. When running activity, your content must has a tabhost whose id attribute is ' Android. R.id.tabhost '
Add layout, XML and element selection Tabhost, but ADT did not add the id attribute, run, will prompt your content must have a tabhost
Whose id attribute is ' Android. R.id.tabhost ' ERROR, need to add android:id= "@android: Id/tabhost", so you can.
Question 2. When running activity, your tabhost must has a tabwidget whose id attribute is ' Android. R.id.tabcontent '
Workaround: Modify the Framelayout Add id attribute, the ADT Auto-generated XML file ID is android:id= "@+id/framelayout01", need to be modified to the next
The format of the polygon android:id= "@android: id/tabcontent", this estimate will bother a large number of beginners, who would have thought would modify this place, see the error easily
Modified to Tabcontent, but the prefix is not easy to think of. And in the ADT visual Editing this file, the interface shows NullPointerException, this is
A bug in ADT.
The modified XML is as follows:
<?xml version= "1.0″encoding=" utf-8″?>
<tabhost
Android:id= "@android: Id/tabhost"
Xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:layout_width= "Fill_parent" android:layout_height= "Fill_parent" >
<linearlayout android:id= "@+id/linearlayout01″android:layout_height=" Fill_parent "
Android:layout_width= "fill_parent" android:orientation= "vertical" >
<tabwidget android:id= "@android: Id/tabs" android:layout_height= "Wrap_content"
Android:layout_width= "Fill_parent" >
</TabWidget>
<framelayout android:id= "@android: Id/tabcontent" android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent" >
</FrameLayout>
</LinearLayout>
</TabHost>
Note: If you use Tabhost, the three places marked red must be the same, this is Google's agreement. And there can only be one tabhost in a project.
Source: http://blog.sina.com.cn/s/blog_5e58565701010bpj.html
Resolution your content must has a ListView whose id attribute is ' Android. R.id.list '