Activity_A:
{
//calling Activity B where i find the user current location lat and lng
Intent intent = new Intent(Activity_A.this, Activity_B.class);
startActivity(intent);
}
Activity_B
{
//after getting user lat and lng, use them in Activity_C to show the initial marker position
Intent intent = new Intent(Activity_B.this, Activity_C.class);
startActivity(intent);
//i don't this Activity_B to show up on back press in Activity_C hence finish(), anyways this Activity_B has no layout
finish();
}
Activity_C:
{
//Show a map with marker at position using lat, lng values from Activity_B, allow user to drag the marker and get the new lat, lng. and then finish this Activity to go to Activity_A
finish();
}
I want this Activity_C send back values of new lat, lng to ACtivity_A without any shared preferences or global variables, i mean by using startActivityForResult and onACtivityResult
Use
setResultand inside activityAget the all data insideOnActivityResult. But starting activity from A to B you need to usestartActivityForResultwith result code. Else you can usebroadcast receiversindependent of all the activities you can send and receive in any activity class.