而pressing后退按钮的Andr​​oid的GridView不会刷新 [英] Android Gridview is not refreshed while pressing back button

查看:262
本文介绍了而pressing后退按钮的Andr​​oid的GridView不会刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个activity.I一个网格视图都使用数组列表设置适配器。 gridview的正在显示的存储在database.Let项的列表说,这是一些产品。 当我点击的任何产品网查看它会浏览我的产品细节画面。 从产品的细节画面,我可以删除product.If我删除产品和preSS后退按钮将导航我的产品列表画面。

I have one grid view in one activity.I have set Adapter using array-list. Gridview is displaying the list of the items stored in the database.Let say it is some products. When i click on any product in the grid-view it will navigate me to product detail screen. From product detail screen i can delete product.If i delete product and press back button it will navigate me to product list screen.

预计:产品列表界面会没有删除的项目

Expected: Product list screen will come without deleted item.

实际:产品列表界面是未来与已删除项目。当触摸这个项目它不会做任何事情。

Actual: Product list screen is coming with deleted item. When touch this item it will do nothing.

支持我的问题,请参见下图

推荐答案

您已经从数据库中活动OnResume方法来获取gridview的项目。而当u删除任何项目,然后回到$​​ P $ PSS,它会调用OnResume previous活动的方法,其中u得到新的列表,并调用notifyDataSetChanged()上的网格,以重新创建视图

You have get gridview items from db in OnResume method of activity. And when u delete any item and then back press, it will call OnResume method of previous activity where u get new list, and call notifyDataSetChanged() on the grid, in order to recreate the view

这篇关于而pressing后退按钮的Andr​​oid的GridView不会刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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