android using setlistadapter() without extending listactivity

android, android-activity, listview

Solution

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.

Problem

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); ```

Original source