Question

I am building an Android app and I am trying to make it compatible with API level 10 using AppCompat library. Normal activities are no problem but when using what used to be ListActivity (now extends from ActionBarActivitity) I am getting problems with setListAdapter(adapter) and other ListView related methods.

What can I do to make my ListActivitity to be compatible with AppCompat?

Was it helpful?

Solution

Use a ListFragment from the support library http://developer.android.com/reference/android/support/v4/app/ListFragment.html

You can use AppCompact and extend ActionBarActivity. In ListFragment you can use setListAdapter(adapter).

If you don't want ListFrament you can have a Listview in activity layout, set the layout to the activity, initialize it in Activity and set adapter to ListView.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top