I’m trying to send some String Data from sub activity to main activity and show that data in edit text field.
Here is my code in sub activity :
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent in = new Intent();
in.setClass(getApplicationContext(),
DelaySmsActivity.class);
in.putExtra("values", stringDataForSend);
setResult(RESULT_OK, in);
finish();
}
});
and here is code from main activity where I’m trying to get that value:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
parametar = data.getStringExtra("values");
editTextField.setText(parametar);
}
after I run this my editTextField is empty.
Try this lets say your present activity is X and Next Activity is Y :-
At Y Activity onCreate