I need to send an object from one activity to another, but after startActivity(i)
.
Example:
Activity A calls Activity B
Something in background should update an object in Activity A, make a copy of that object (as opposed to sending the reference), and send it to Activity B (which is already started).
<activity
android:name="gui.GUIConversacion"
android:label="@string/app_name" >
<intent-filter>
<action android:name="action.action.myactionstring" />
</intent-filter>
</activity>
Intent intent = new Intent("action.action.myactionstring");
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra("conversacionActualizada",conversacionesCache.get(c));
startActivity(intent);
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if ("action.action.myactionstring".equals(intent.getAction())) {
this.conversacion=(Conversacion) intent.getExtras().get("conversacionActualizada");
actualizarGUI();
}
}