当课程没有延长ListView
时,我是否可以创建动态填充的ListActivity
?
我很感激帮助。
答案 0 :(得分:2)
是。例如:
public class StoreListActivity extends Activity {
private List<Store> mStores;
private StoreAdapter mStoreAdapter;
private ListView mListView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.store_list);
mListView = (ListView) findViewById(R.id.store_listview);
mStores = getTheStoresFromSomewhere();
mStoreAdapter = new StoreAdapter(this, mStores);
mListView.setAdapter(mStoreAdapter);
}