I need to display output when checkbox is checked, the problem is when I start the apps, the output is displayed before checkbox is checked. This is my code:
checkBox1.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
if ( isChecked )
{
txt1.setVisibility(View.VISIBLE);
}else{
txt1.setVisibility(View.GONE);
}}}
);
checkBox2.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
if ( isChecked )
{
txt2.setVisibility(View.VISIBLE);
}else{
txt2.setVisibility(View.GONE);
}}}
);
Aucun commentaire:
Enregistrer un commentaire