NullPointerException error is occurring in this line of code in
Receiver code:
String summaryResult = ReceiverBundle.getString("summaryResult");
For what reason?
Sender Code:
@Override
public void onClick(View view) {
Intent senderIntent = new Intent(getApplicationContext(), UserRegistration1.class);
Bundle senderBundle = new Bundle();
senderBundle.putString("summaryResult", summaryResult);
senderIntent.putExtras(senderBundle);
startActivity(senderIntent);
Toast.makeText(getApplicationContext(), "It was sent: " + summaryResult, Toast.LENGTH_LONG).show();
Intent intent = new Intent(getApplicationContext(), UserRegistration1.class);
startActivity(intent);
}});
Receiver Code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.UserRegistration1);
Intent ReceiverIntent = getIntent();
Bundle ReceiverBundle = ReceiverIntent.getExtras();
String summaryResult = ReceiverBundle.getString("summaryResult"); // NullPointerException here
Toast.makeText(userRegistration1.this, "Getting the summary result: " +summaryResult, Toast.LENGTH_LONG).show();