I am trying to pass HashMap through arguments .But I am getting empty hashmap while getting it through getSeralizable method(Hashmap that I am putting is not empty & having a size of 11). The following is my code snippet.
public static FirstPageFragment newInstance(boolean is_pending, HashMap<String, Object> result_map) {
FirstPageFragment fragment = new FirstPageFragment();
Bundle args = new Bundle();
args.putBoolean(ARG_PARAM1, is_pending);
args.putSerializable(ARG_PARAM2, result_map);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
Bundle b=getArguments();
isPending = b.getBoolean(ARG_PARAM1);
mResultMap = (HashMap<String, Object>)b.getSerializable(ARG_PARAM2);
}
}
Can we do like this? If it can't be done like this, is there any alternate way to do this.