CodeSculptor
CodeSculptor

Reputation: 201

Application don't works when pricipal activity inherits of ListActivity class

I have a simple list application in Android 4.1 and when it's inheriting of Activity, works perfectly... but when this same application inherit of ListActivity, it fails. Could anyone tell me why?

Upvotes: 1

Views: 100

Answers (1)

G_S
G_S

Reputation: 7110

You might have a listview in your layout xml file.Change it as below.

<ListView android:id="@android:id/list" android:layout_width="wrap_content"
android:layout_height="wrap_content"></ListView>

and check whether its working or not

check out the sample here. You may find this useful. This is a sample where list view is obtained from extending the ListActivity.

also have a glance at this here

ListActivity has a default layout that consists of a single, full-screen list in the center of the screen. However, if you desire, you can customize the screen layout by setting your own view layout with setContentView() in onCreate(). To do this, your own view MUST contain a ListView object with the id "@android:id/list"

Upvotes: 1

Related Questions