0
後,我設置的ListView的適配器我需要的項目從一個線程如下更改的ListView項目
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
listView = (ListView) findViewById(R.id.ListView01);
listView.setOnItemClickListener(this);
DirectoryBrowser dirBrowser= new DirectoryBrowser();
Vector<List<String>> fileCollection=dirBrowser.getList();
List<String> filesNames= fileCollection.elementAt(0);
List<String> filesDate= fileCollection.elementAt(1);
List<String> filesSize= fileCollection.elementAt(2);
filesPath= fileCollection.elementAt(3);
Log.d("swv file","swv file=" + filesDate.size());
final MyArrayAdapter myAdapter= new MyArrayAdapter(this, filesNames,filesDate,filesSize);
int res=myAdapter.getCount();
listView.setAdapter(myAdapter);
myAdapter.notifyDataSetChanged();
Thread thread= new Thread(new Runnable() {
public void run() {
View rowView =myAdapter.getView(0, null, null);
ViewHolder holder = new ViewHolder();
holder.tv_name = (TextView) rowView.findViewById(R.id.label);
holder.tv_name.setText("dddddd");
myAdapter.notifyDataSetChanged();
}
});
thread.start();
myAdapter.notifyDataSetChanged();
}
我的問題復位了項目沒有改變