Button button = (Button) rootView.findViewById(R.id.button1);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getActivity(), AnotherActivity.class);
startActivity(intent);
}
});
Intent intent = new Intent(MainActivity.this,MainActivity2.class);
intent.putExtra("key",value);
startActivity(intent);
////////////////////
String string =getIntent().getStringExtra("key");
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(R.id.editTextTextPersonName);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
/*this intent takes us to the activity named DisplayMessageActivity*/
/*it also carries with us the text message*/
{"error":"invalid file name"}