why this code crushs? [on hold]



First activity



Button btnSubmit = (Button) findViewById(R.id.btnSubmit);
final EditText edtName = (EditText) findViewById(R.id.edtName);
final EditText edtFamily = (EditText) findViewById(R.id.edtFamily);
final EditText edtAge = (EditText) findViewById(R.id.edtAge);

btnSubmit.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {

String inputName = edtName.getText().toString();
String inputFamily = edtFamily.getText().toString();
String inputAge = edtAge.getText().toString();

Intent intent = new Intent(getApplicationContext(),SecondActivity.class);

intent.putExtra("NAME", inputName);
intent.putExtra("FAMILY", inputFamily);
intent.putExtra("AGE", inputAge);

startActivity(intent);




Second Activity



TextView txtName = (TextView) findViewById(R.id.txtName);
TextView txtFamily = (TextView) findViewById(R.id.txtFamily);
TextView txtAge = (TextView) findViewById(R.id.txtAge);

Button btnNext = (Button) findViewById(R.id.btnNext);
Button btnEdit = (Button) findViewById(R.id.btnEdit);

Bundle extras = getIntent().getExtras();
if (extras != null) {
String inputName = extras.getString("NAME");
String inputFamily = extras.getString("FAMILY");
String inputAge = extras.getString("AGE");

txtName.setText(inputName + "");
txtFamily.setText(inputFamily + "");
txtAge.setText(inputAge + "");


in firstActivity there r 3 edit texts that user must fill and whn hit "submit" button ,information that user entered will be wroten in 3 TextView of SecondActivity...but whn i hit "submit" btn..it crushes.. any help?


No comments:

Post a Comment