I have a form in which I'm filling the details & to get the location I'm using Google Maps
. But when I get back to the activity after getting the location from maps all fields are null
.
How do I store the state before moving to maps and get that exact state after coming back from maps activity?
EDIT: Fragment's onCreate
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
// Here I used recreate but it didn't work
// getActivity.recreate();
View view = inflater.inflate(R.layout.fragment_login, container, false);
ButterKnife.bind(this, view);
return view;
}
From here i'm going to map Activity
@OnClick(R.id.frag_expense_lllocation)
public void getLocation(){
UiActivity.startMapActivity(context);
}
and to get back to current activity with selected location
double lat = marker.getPosition().latitude;
double lng = marker.getPosition().longitude;
String position = lat + "," + lng;
UiActivity.startExpenseActivity(getContext(), position);
getActivity().finish();