I've searched how to solve this problem a lot, but i did not get any result. the only help that i need is, please take a look at this question asked on stackoverflow and on answer;
here is the question from this link:
"my activity does not extend ListActivity so this line throws an error. setListAdapter(fileList); it is supposed to populate a listview..."
ArrayAdapter<String> fileList =
new ArrayAdapter<String>(this, R.layout.row, item);
ArrayAdapter<String> adapter =
new ArrayAdapter<String>(this, R.layout.reminder_row, R.id.text1, items);
As explained in the linked question and in this question's comments, it goes like this:
ArrayAdapter<String> adapter =new ArrayAdapter<String>(this, R.layout.reminder_row, R.id.text1, items); ListView lv = (ListView)findViewById(R.id.your_listview_id); lv.setAdapter(adapter);
ListActivity is a specialized
Activity that hosts a
ListView and has some convenience methods for accessing and manipulating it. However, nothing prevents you from having a
ListView in a non-
Activity, you just lose the convenience methods and will have to write some more code yourself, like above.