Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void onBackPressed() {
- Intent data = new Intent();
- data.putExtra("Latitude", location.getLatitude() );
- data.putExtra("Longitude", location.getLongitude());
- setResult(RESULT_OK,data);
- super.onBackPressed();
- }
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if(requestCode == request_Code){
- if(resultCode == RESULT_OK){
- Location location = new Location(provider);
- location.setLatitude(data.getDoubleExtra("Latitude", 0));
- location.setLongitude(data.getDoubleExtra("Longitude", 0));
- listener.onLocationChanged(location);
- }
- }
- super.onActivityResult(requestCode, resultCode, data);
- }
- @Override
- protected void onResume() {
- super.onResume();
- // update your location here
- }
- Take a flag in Activity A.
- you are going A->B
- when you press back ,B finish();chack flag =true;and you will come back to A,
- Now in A's onresume() method check for flag and if flag is true then update location
Add Comment
Please, Sign In to add comment