Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

what it the best from ListActivity andActivity  RSS feed

 
sam liya
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what it the best from ListActivity andActivity for show listview ?
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
aruna sameera wrote:what it the best from ListActivity andActivity for show listview ?

I'm not sure what you mean. Can you tell us what you are trying to do?
 
Hardik Trivedi
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both are same...
ListActivity has some methods using which you can easily find your ListView and set Adapters,Listeners on that using getListView() setListAdapter() et cetera methods.

While in Activity you have to write
 
sam liya
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But i heard that using ListActivity it is unable to display two item list.two item list mean there is a list.when one of item select from that list it shows another list.
example

here is primary list.

car
bus
train
.....

if i select car ,then it shows another list of cars......
can it implimwnted by using ListActivity
 
Hardik Trivedi
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yea that is limitation.
You can not display two list using getListView() method of ListActivity

Reason :

ListView has method getListView which returns reference of list view who is having id list that is the reason we have to have give id @android:id/list in our xml while using ListActivity

So getListView will return only that single list view.

To define new list we must give new id and that new id will be in our name space and we have to use findViewById method in this case.



But we can use one list from android name space and one from our defined name space.


I hope this clears your doubt ...


 
Swastik Dey
Rancher
Posts: 1784
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably no, because ListActivity itself will represent one view, but as per your requirements you need two views.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!