It shows the application has stopped but shows no error in the code, can someone explain why this is happening. Is there any pluglin to find error in such kind of codes Activity1
EditText edt1,edt2,edt3;
Button btn1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
edt1=findViewById(R.id.edt1);
edt2=findViewById(R.id.edt2);
edt3=findViewById(R.id.edt3);
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String str=edt2.getText().toString();
String str2=edt3.getText().toString();
Intent intent= new Intent(getApplicationContext(),Main2Activity.class);
intent.putExtra("email",str);
intent.putExtra("password",str2);
startActivity(intent);
}
});
}
}
Activity2
TextView edt21,edt22;
Button btn21;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
edt21=findViewById(R.id.edt21);
edt22=findViewById(R.id.edt22);
Intent intent=getIntent();
String str= intent.getStringExtra("email");
String str2= intent.getStringExtra("password");
edt21.setText(str);
edt22.setText(str2);