[Solved] GridView is not refreshing with notifyDataSetChanged()


First thing first notifyDataSetChanged() only will work with the same reference of dataset . And you have created a new list int your adapter’s constructor . So you are going nowhere from here . It should as simple as .

private ArrayList mArraylist = new ArrayList();
public MenuGridViewAdapter(Activity activity, ArrayList mArraylist) {
    this.activity = activity;
    this.mArraylist = mArraylist;
}

Below are some mistakes you have made.
1.. You have created a new instance of dataset so notifyDataSetChanged will not work.
2. You have called notifyDataSetChanged() in the constructor why ? Its useless.

So the whole point is dataset reference should be same. Then only notifyDataSetChanged will work only if you made changes in the same list.

Suggestion:- Move to RecyclerView with GridLayouManager. It provide the better approach for ViewHolder pattern.

3

solved GridView is not refreshing with notifyDataSetChanged()