I have 2 Activities.
When I click the Button in board Activity, main will open and execute, then send value (mark) to the board Activity
It works.
But I want also to send 3 arrays from the board Activity to the main Activity, as variables, according which Button is clicked (I have 3 Buttons in the board Activity, each array for Button).
This is the function I used in board Activity:
public void getMessage(View V) {
// Create The Intent and Start The Activity to get The message
Intent intentGetMessage = new Intent(this, MainActivity.class);
startActivityForResult(intentGetMessage, 2);// Activity is started with requestCode 2
}
// Call Back method to get the Message form other Activity override the method
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
// check if the request code is same as what is passed here it is 2
if (requestCode == 2) {
// fetch the message String
String message = data.getStringExtra("MESSAGE");
// Set the message string in textView
mm.setText(message);
and this is the submit function in the main Activity :
public void submitMessage(View V) {
String message = String.valueOf(mark);
Intent intentMessage = new Intent();
// put the message to return as result in Intent
intentMessage.putExtra("MESSAGE", message);
// Set The Result in Intent
setResult(2, intentMessage);
// finish The activity
finish();
}