I need get te value from checkbox and show in other activity and display in textview.
This is the code FormSupervisar.
public class FormSupervisar extends Activity {
CheckBox Si;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.formsupervisar);
Si=(CheckBox)findViewById(R.id.chBoxSi);
}
public void btnEnviar(View view){
if (Si.isChecked()){
Intent i = new Intent(this,FormBotonSi.class);
i.putExtra("Si",Si.getText().toString().trim());
startActivity(i);
}
}
The activity when i call the string and show the String in a TextView
public class FormBotonSi extends Activity {
private String ,Si ;
private TextView tvTipoInspeccion;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.formbotonsi);
Bundle bn1 = getIntent().getExtras();
Si = bn1.getString(Si);
tvTipoInspeccion.setText(Si.toString());
}
}
Try it this way…..
One more thing… While you code in Java you must follow the Camel case. Field and Methods always starts with small letter whereas Class, Interface, Enums, Constructors starts with Capital letters.