Skip to content Skip to sidebar Skip to footer

Update And Remove Gridview Items At Runtime

i am developing a project where i compare the images of two items,So if two items will have same image after clicking these items should be hide. my code is given below and this co

Solution 1:

You have

finalImageViewmyimage=newImageView(ctx);

ctz is not initialized. Its only declared as Context ctx;

You have this

gridView.setAdapter(adapter);

But you need to intialize adapter before using the same

So change to

setContentView(R.layout.main);
finalImageViewmyimage=newImageView(this); //this refers to Activity context
gridView = (GridView) findViewById(R.id.gv_memory);
adapter = newImageAdapter(this)
gridView.setAdapter(adapter);

Post a Comment for "Update And Remove Gridview Items At Runtime"