You can delete ImageButton

1

I'm creating multiple ImageButton

 ImageButton imageButton = (ImageButton) LayoutInflater.from(this).inflate(R.layout.imagebutton, null);
            imageButton.setImageBitmap(bMap);

            layoutC.addView(imageButton);

I wanted to know if you can remove them from the layout.

    
asked by anonymous 19.12.2014 / 20:45

1 answer

2

You will need to provide an ID for each ImageButton .

ImageButton imageButton = (ImageButton) LayoutInflater.from(this).inflate(R.layout.imagebutton, null);
imageButton.setImageBitmap(bMap);
imageButton.setID(id_do_seu_imageButton);

ImageButton imageButton = (ImageButton) layoutC.findViewById(R.id.id_do_seu_imageButton);
((LinearLayout) imageButton.getParent()).removeView(imageButton);
    
19.12.2014 / 20:50