I am trying to pass variable locDistance
value to the fragment. I have a tried below code inside an Activity:
protected void onPostExecute(Double distance) {
locDistance = distance;
Bundle bundle = new Bundle();
bundle.putDouble("distance", locDistance );
// Fragment class Arguments
Fragment obj = new Fragment();
obj.setArguments(bundle);
}
Then getting value in fragment as follows inside onCreate()
:
Double distance_value= getArguments().getDouble("distance");
But I'm getting value 0.0 . Any help would be appreciated.