I have 2 activity i make a Checkbox and button in same activity when i click on button the checkbox is mark checked automaticaly.my problem is i want this button in another activity .now i use this code public class MainActivity extends Activity {
CheckBox mCheckBoxRegular;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mCheckBoxRegular = (CheckBox) findViewById(R.id.checkBox1);
Button regular = (Button) findViewById(R.id.button1);
regular.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCheckBoxRegular.setChecked(true);
}
});
}
}
Aucun commentaire:
Enregistrer un commentaire