Arda Çebi Arda Çebi - 25 days ago 9
Java Question

Making components invisible with button

How can I make a component on my MainUI invisible by pressing a button? I want to dismiss a warning box on my MainActivity with a button that says "Close" or with a cross image.

Answer
Button crossButton = (Button) findViewById(R.id.crossImage)
Button button1 = (Button) findViewById(R.id.buttonOne)
//and so on

crossButton.setOnClickListener(new View.OnClickListener(){
    @Override
    public void onClick(View v){
        button1.setVisibility(GONE);
        //and so on
    }
});