刷新活动时,对话框驳回 [英] Refreshing Activity When Dialog Dismisses

查看:110
本文介绍了刷新活动时,对话框驳回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其实我的列表中的活动,当用户点击任何项目,一个对话框会打开,删除和cancel.When用户两个选项中选择删除按钮关闭对话框驳回与删除值database.And旧列表活动进来前景与老values​​.Though它被删除它显示在listview.Is有没有办法显示刷新list.If肯定的,那么如何?

Actually in my list activity,when user taps on any item ,a dialog box is opened with two options of delete and cancel.When user select delete button the dialog dismisses with deleting value in database.And the old list activity comes in foreground with old values.Though it is deleted it is showing in listview.Is there a way to show the refreshed list.If yes,then How?

推荐答案

如果您使用的是数组列表,那么你必须明确地知道该项目的位置,并使用那个位置,你可以从列表中删除项。然后调用

If you are using array list then you must definitely know the item position and using that position you can remove item from your list .Then call the

     yourlist.remove(position);
     adapter.notifyDataSetChanged();

运行您的程序来观看魔术。

run your program to watch the magic.

这篇关于刷新活动时,对话框驳回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆