I have an ExpandaleList, and BaseExpandableListAdapter which I implements.
Now sometimes I need to show other xml content, So I am trying to do:
ExpandableList.this.setContentView(R.layout.errorsc开发者_运维知识库reen);
but then I get this exception:
ERROR/AndroidRuntime(23948): java.lang.RuntimeException, Your content must have a ExpandableListView whose id attribute is 'android.R.id.list'.
Now, I have been told to do this in order to fix it:
add ExpandableListView to your xml layout and set it's id to list. Like so:
<ExpandableListView android:id="@id/android:list" android:layout_width="fill_parent"android:layout_height="fill_parent"/>
How to do it programmatically?
You are setting this Activity's contentView to a Layout which is defined in an xml file called errorscreen.xml:
ExpandableList.this.setContentView(R.layout.errorscreen);
The activity you're doing this from however extends ExpandableListActivity (I guess). Such an Activity needs an ExpandableListView in it's xml to display it's data. Now simply open your errorscreen.xml and add this element.
Cheers
精彩评论