简体   繁体   English

如何从Android中的列表视图中删除列表视图项

[英]how to remove Listview Item from listview in android

i want to delete listview item On click i have created remove methode TO Deleted .. But When I click On Button It Only like Just Refreshed Not Deleted That Item please Tell ME Where I m Doing Wrong 我想删除listview项在单击时,我创建了remove方法TO Deleted ..但是,当我单击On Button时,它就像只是刷新未删除的那个项,请告诉我我在哪里做错了

Button yes=(Button)convertView.findViewById(R.id.yes);
        yes.setTag(position);
        yes.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                UserProfile u=new UserProfile();

                resultp.remove(data.get(position));
                   notifyDataSetChanged();
                 Toast.makeText(context, "yes", Toast.LENGTH_SHORT).show();

            }
        });

here is my Code im using On Button click in this resultp is 这是我的代码即时消息使用开按钮单击此结果是

 HashMap<String, String> resultp = new HashMap<String, String>();

and data Is Array list 和数据是数组列表

i will appreciate your answer 我会很感激你的回答

you must the line 你必须行

resultp.remove(position);

and then 接着

resultp.notifyDataSetChanged();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM