You should not create the new instance of MapFragment
.
To pass the values, set them in Argument while adding them in the Transaction :
Bundle bundle = new Bundle();
bundle.putDouble("lat", latitude);
bundle.putDouble("long", longitude);
bundle.putString("address", address);
myFragment.setArguments(bundle);
And fetch the value in onCreate()
like :
@Override
public View onCreate(Bundle savedInstanceState) {
Bundle mBundle = getArguments();
if (mBundle != null) {
String address = mBundle.getString("address");
// Call method
setLocation(mBundle.getDouble("lat"), mBundle.getDouble("long"), mBundle.getString("address"));
} else {
Toast.makeText(getActivity(), "Location Not Found", Toast.LENGTH_SHORT).show();
}
}
Hope it helps ツ
1
solved Latitude value set to 0