Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android using setlistadapter() without extending listactivity

lots of searching and reading has not provided the answer to this problem. my activity does not extend ListActivity so this line throws an error. setListAdapter(fileList);

it is supposed to populate a listview, any solid help is much appreciated.

 ArrayAdapter<String> fileList =
    new ArrayAdapter<String>(this, R.layout.row, item);
    setListAdapter(fileList);
like image 845
user1614848 Avatar asked Aug 06 '26 12:08

user1614848


1 Answers

Obtain the reference of your ListView using findViewById(int). Then call the method ListView.setAdapter(ListAdapter) on that reference with your adapter as the parameter.

like image 155
Paul Avatar answered Aug 09 '26 01:08

Paul