2012-09-29 82 views
0

我的适配器有问题。所有工作正常,但我清除我的清单有问题。清除自定义ListAdapter

我清除它是这样的:

public void onResetClicked(View v) { 
    Log.d(TAG, "reset button clicked"); 
    m_stopwatchService.reset(); 

     alist.clear(); 
    } 

它不工作。

编辑

它的工作原理,但我不能重新创建列表。

public void onResetClicked(View v) { 
    Log.d(TAG, "reset button clicked"); 
    m_stopwatchService.reset(); 

     alist.clear(); 
     listView.setAdapter(null); 
    } 

这是一个秒表。我的适配器创建圈。当我按下“重置按钮”时想要清理我的圈数列表。

EDIT2

我解决我的问题。

我把它叫做是这样的:

listView.setAdapter(null); 
     listView.setAdapter(adapter); 
+1

是什么'alist'?你的ListView或你的适配器?您是否在自定义适配器中覆盖/实现了'clear'?向我们展示更多代码! – theomega

回答

0

一旦你清除适配器就得无效视图。

alist.clear();

listView.invalidateViews();

相关问题