Skip to content Skip to sidebar Skip to footer

Edittext Visible Means How Can I Check The If Condition In Android

I have checked my edittext is visible or invisible in android. Now i have to check the condition is., If my edittext is visible means how can i insert the data. If my edittext is

Solution 1:

use

if(Saddress.getVisibility() == View.VISIBLE){
  //.. your code here
}

instead of

if(Saddress== VISIBLE){
//.. your code here
}

because VISIBLE,GONE and INVISIBLE is part of View class instead of Activity

Solution 2:

EditTexteditText= (EditText)findViewById(R.id.editText1);
editText.getVisibility();

this will provide the edittext is VISIBLE, INVISIBLE, or GONE.

if(editText.getVisibility() == View.VISIBLE){
   //.. your actions are performed here
}

Refer This. You can find some interesting details about VISIBLE ,GONE and INVISIBLE

Post a Comment for "Edittext Visible Means How Can I Check The If Condition In Android"