With some basic knowledge in this area, to pass data between multiple Activities
i have created Parcelable
class.
My two Activities
structure looks similar to the below image,
where within the onClick
event listener of button1
, i have the below code snippet to pass the selectedText
(where the value of selectedText is "Header text" which in displayed above the button1)
ParcelableClass _ParcelableClass = new ParcelableClass(selectedText);
Intent intent = new Intent(mContext,Editor.class);
intent.putExtra("_ParcelableClass",ParcelableClass);
startActivity(intent);
In the ParcelableClass
i can read
and write
the values, so that selectedText
can be assigned to the EditText
available in the second activity.
where my requirement is to pass the edited text (new Header text
) to the first activity when Ok
button is selected, based on that selectedText
in the first activity should also changed into "new Header Text".
Do i need to created new Intent while click the ok
button, if so it will create a new bundle for the first activity. so i just need to change the header value alone, based on the edited text in the second activity.