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

Exception or error:

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.

How to solve:

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


You can call:

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

Leave a Reply

Your email address will not be published. Required fields are marked *