How to empty a gridview on Android?
android, double, gridview, icons
Solution
I had the same problem myself. The easiest way to do this is:
gridview.setAdapter(null);
Problem
I am developping a launcher with two different profiles : one is the main one the other is secondary. If I go on the play store and then come back with the "back" button, I land on my main profile, but there, the icons of my gridview (displayed through an adapter) appear in double (if I install two apps from the play store, coming back with the back button will give me icons 3 times and so on). If I restart my main activity in the onresume method, things go fine and my icons aren't doubled, or tripled or whaterver. But I don't want to restart the activity, I only want to empty my gridview. ``` if((admin == true) ){ Intent intent = getIntent(); finish(); startActivity(intent);} ```