如何
firstAdapter
知道它何时与listView的实际适配器分离(因为
secondAdapter
替换它)?
final ListAdapter firstAdapter = new SimpleAdapter(
this,
new ArrayList<Map<String, Object>>(),
android.R.layout.simple_list_item_1,
new String[] {"AAA"},
new int[] {android.R.id.text1}
);
final ListAdapter secondAdapter = new SimpleAdapter(
this,
new ArrayList<Map<String, Object>>(),
android.R.layout.simple_list_item_1,
new String[] {"AAA"},
new int[] {android.R.id.text1}
);
setListAdapter(firstAdapter);
(new Timer()).schedule(new TimerTask() {
@Override
public void run() {
Runnable r = new Runnable() {
@Override
public void run() {
setListAdapter(secondAdapter);
}
};
new Handler(Looper.getMainLooper()).post(r);
}
}, 1000);