Solved

ListActivity

Posted on 2012-04-06
2
455 Views
Last Modified: 2012-04-09
Please see the attahed file. When I extend Activity everything works fine. When I extend ListActivity the application crashes. Why is that? Am I not implementing something?

Basically trying to implement a screen with a few navigation buttons, and in the middle a ListView. Need help implementing.
ListActivity.txt
0
Comment
Question by:InfoTechEE
2 Comments
 
LVL 8

Accepted Solution

by:
Santhana earned 500 total points
ID: 37818561
Hi  InfoTechEE,

Refer this from android docs.
http://developer.android.com/reference/android/app/ListActivity.html

You must have the list view with the id "@android:id/list" in your layout file "saved"

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

Get this list from the activity like this

listDisplayFiles = (ListView) findViewById(android.R.id.list);

Other wise it will through the error at run time...
0
 
LVL 7

Expert Comment

by:tampnic
ID: 37821378
If your writing code within the list activity its easier and faster to get the ListView associated with the activity by using the getListView() function (inherited from the base class ListActivity). This function returns the list reference directly from the base class without having to do a (sometimes costly) findViewById() call.

Cheers,
  Chris
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Viber 1 43
IT Company 5 77
record call on android mobile 16 131
move file from android 2 45
Working settings for French ISP Orange "Prêt à Surfer" SIM cards for data connections only. Can't be found anywhere else !
In this article we will discuss all things related to StageFright bug, the most vulnerable bug of android devices.
This video is in connection to the article "The case of a missing mobile phone (https://www.experts-exchange.com/articles/28474/The-Case-of-a-Missing-Mobile-Phone.html)". It will help one to understand clearly the steps to track a lost android phone.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now