I have one button (buttton1
) in the first activity and the second activity has a textview
(textView1
). This is the code that I wrote:
public void buttton1 (View v){
Intent buttton1 = new Intent (MainActivity.this, Back.class);
startActivity(buttton1);
TextView textView = (TextView)findViewById(R.id.textView1);
textView.setText("Hello");
finish();
}
When I run the application and when I click on the button, it force-closes. So please help me where is the fault?