What is the error in radioButton1.getText().toString().equals("") in code below?
I want to force the user to fill in this field and if he leaves the field empty then toast a message that fills the required field. How do I do this?
page1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if(radioButton1.getText().toString().equals("")||radioButton2.getText().toString().equals("")||radioButton3.getText().toString().equals("")||radioButton4.getText().toString().equals("")
||petn.getText().toString().equals("")||breed.getText().toString().equals("")||color.getText().toString().equals("")||alergic.getText().toString().equals("")||ath_locat.getText().toString().equals("")||d_condi.getText().toString().equals("")||weight1.getText().toString().equals("")
)
{
Log.e("onclick", ",pd");
Toast msg = Toast.makeText(
My2Activity.this,"Please fill the * required field",Toast.LENGTH_LONG);
msg.show();
}
else{
PostData();
Intent d = new Intent(getApplicationContext(),
My1Activity.class);
startActivity(d);
}
}
});
you want to set OnCheckedChangeListener to radio button