0

当我在 android 列表上用后退键隐藏键盘时,它可以正常工作并且我添加了新项目。我想刷新列表而不使用返回键隐藏键盘。我的代码是:

lv=(ListView) findViewById(R.id.listView1);
strArr=new ArrayList<String>();
adapter = new CustomListAdapter(getApplicationContext() , R.layout.custom_list , strArr);

lv.setAdapter(adapter);

while( ( line = br.readLine() ) != null ){
    strArr.add(line);
}

adapter.notifyDataSetChanged();
4

1 回答 1

0

在单击后退按钮之前,您会陷入循环。尝试:

while( ( line = br.readLine() ) != null ){
   strArr.add(line);
   adapter.notifyDataSetChanged();
}
于 2014-08-25T12:20:06.640 回答