I'm trying to launch an android activity from my Main activity, but I get force stop. The logcat
error is like this:
java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
But the activity that I try to launch already has a ListView
with the id "list". Any advice is appreciated. UPDATE: Still can't figure out what's wrong. Here's my code:
activity_all_apps.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.example.app.AllAppsActivity">
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
and AllAppsActivity.java
public class AllAppsActivity extends ListActivity
In your XML layout file related to this Activity you should have a ListView
element that whose id is @android:id/list
. Something like this.
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ListView>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.