Einsambr Einsambr - 2 months ago 8
Android Question

How do I delete an imageview so that it no longer exists?

For some certain reasons, I have created some

ImageViews
and assigned specific IDs to them (1, 2, 3, 4, ......). Now I want to COMPLETELY DESTROY those
ImageViews
so that I can assign the IDs (1, 2, 3, 4, ......) to other
ImageViews
. Can anyone tell me how to delete an
ImageView
so that it no longer exists?

Thanks for your help!

Answer

You can use following code.

View image_view= view.findViewById(R.id.id_OF_IMAGEVIEW);
((ViewGroup) namebar.getParent()).removeView(image_view);

Hope this helps you..

Comments