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 gone means how can i insert on another data.
This is my code for if i have to check the checkbox means the edittext is invisible otherwise the edittext is visible .:
chkIos = (CheckBox) findViewById(R.id.addresscheckbox);
chkIos.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (((CheckBox) v).isChecked())
{
S_address = (TextView)findViewById(R.id.address1);
S_address.setVisibility(View.GONE);
Saddress = (EditText)findViewById(R.id.tf_address1);
Saddress.setVisibility(View.GONE);
}
else
{
S_address = (TextView)findViewById(R.id.address1);
S_address.setVisibility(View.VISIBLE);
Saddress = (EditText)findViewById(R.id.tf_address1);
Saddress.setVisibility(View.VISIBLE);
if(!(Saddress.getText().toString().length() == 0)){
showAlertbox(" Shipping Address is Required!!");
}
}
The below code is ., if my edittext is visible means insert the saddr value.otherwise insert the baddr value.how can i check the condition.
Here below error is showing: VISIBLE cannot be resolved to a variable.
if(Saddress== VISIBLE)
{
PropertyInfo saddress =new PropertyInfo();
saddress.setName("Saddress");//Define the variable name in the web service method
saddress.setValue(saddr);//Define value for fname variable
saddress.setType(String.class);//Define the type of the variable
request.addProperty(saddress);//Pass properties to the variable
}
else
{
PropertyInfo saddress =new PropertyInfo();
saddress.setName("Saddress");//Define the variable name in the web service method
saddress.setValue(baddr);//Define value for fname variable
saddress.setType(String.class);//Define the type of the variable
request.addProperty(saddress);//Pass properties to the variable
}
please see the full source code here:full code
EDIT:
In my code i have to check the checkbox means the Saddress is invisible know.that time i have to click the button means the baddr value is inserted...If i have to uncheck the checkbox means the Saddress value is visible.that time i have to insert the saddr value.
Here i have to run the app means the baddr value is insered both Saddress==visible and Saddess==invisible case.how can i write the condition for these.
this will provide the edittext is VISIBLE, INVISIBLE, or GONE.
Refer This. You can find some interesting details about VISIBLE ,GONE and INVISIBLE
use
instead of
because
VISIBLE
,GONE
andINVISIBLE
is part of View class instead of Activity