I wish this could not happen.
The user clicking on the other CheckBox
, deactivated the one previously marked.
MainActivity.java
package genesysgeneration.umouoto;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
public class MainActivity extends AppCompatActivity {
private CheckBox cb01, cb02;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
cb01=(CheckBox)findViewById(R.id.cb01);
cb02=(CheckBox)findViewById(R.id.cb02);
addCheckBoxChecked();
}
public void addCheckBoxChecked(){
cb01.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(((CheckBox)v).isChecked()){
}
}
});
cb02.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
}