小编joh*_*eow的帖子

Android:如何在自定义SimpleAdapter中删除项目时刷新列表

我可以知道在自定义SimpleAdapter中删除地图列表项后如何刷新ListView项目?

我已经用list.remove(position)成功实现了删除列表项,但是当我试图调用list.notifyAll()函数但它给了我一个错误消息,如"java.lang.IllegalMonitorStateException:对象在notifyAll之前没有被线程锁定()".

我希望你能帮助我.这是自定义SimpleAdapter的代码.

public class DeleteAdapter extends SimpleAdapter {

    Context context;
    List<? extends Map<String, ?>> list;
    int resource;
    String[] from;
    int[] to;

    public FDeleteAdapter(Context context, List<? extends Map<String, ?>> data,
            int resource, String[] from, int[] to) {
        super(context, data, resource, from, to);

        this.context = context;
        this.list = data;
        this.resource = resource;
        this.from = from;
        this.to = to;
        // TODO Auto-generated constructor stub
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {

        final View row = super.getView(position, convertView, …
Run Code Online (Sandbox Code Playgroud)

android listview notify delete-row simpleadapter

5
推荐指数
1
解决办法
6834
查看次数

标签 统计

android ×1

delete-row ×1

listview ×1

notify ×1

simpleadapter ×1