Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to findViewById() an @android:id/list element in an Android activity?

Tags:

android

xml

I am trying to get the ListView by using the findViewById function, yet I am unsure what I am trying to find or what to use as an argument: R.id.list does not work.

like image 276
Allen Gingrich Avatar asked Aug 10 '10 15:08

Allen Gingrich


2 Answers

You can call:

ListView mListView = (ListView) findViewById(android.R.id.list);
like image 187
Pete Avatar answered Nov 07 '22 00:11

Pete


In your activity, try getListView(), you'll have access to your ListView

like image 39
fedj Avatar answered Nov 07 '22 00:11

fedj