当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Only one of my array adapters will work at a time in my row

问题描述:

I have two textfields in my row, and I'm using array adapters to assign their text. However, only one of them will work at a time. If I comment one out, then the other will work, and vice versa. What am I doing wrong here and how can I make it work properly?

private void getFiles() {

names = new ArrayList<String>();

times = new ArrayList<String>();

path = new ArrayList<String>();

File f = new File(getString(R.string.file_path));

File[] files = f.listFiles();

for(int i=0; i < files.length; i++) {

File file = files[i];

path.add(file.getPath());

names.add(file.getName());

CharSequence relativeTime = DateUtils.getRelativeTimeSpanString(file.lastModified());

times.add((String) relativeTime);

}

ArrayAdapter<String> messageSenders = new ArrayAdapter<String>(this, R.layout.list_item, R.id.message_name, names);

ArrayAdapter<String> messageTimes = new ArrayAdapter<String>(this, R.layout.list_item, R.id.message_time, times);

setListAdapter(messageSenders);

setListAdapter(messageTimes);

}

分享给朋友:
您可能感兴趣的文章:
随机阅读: