Solved

ListActivity

Posted on 2012-04-06
2
433 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:
santhanasamy earned 500 total points
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

First off, some of you reading this are already thinking there is an error in the title. It really should be Kindle Fire versus OTHER Android tablets. That's because the Amazon Kindle Fire IS an Android tablet. Well, it is and it's not. It's running…
A short article about problems I had with the new location API and permissions in Marshmallow
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 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

7 Experts available now in Live!

Get 1:1 Help Now