I'm getting this error
Caused by java.lang.IllegalArgumentException: Duplicate key in ArrayMap: null
not in my current device but it is coming from crashlytics, but i cant regenerate this issue in my own device tried all possible ways but cant get this same error in my device, below is my code, answers would be really appreciated.
public class QuestionSwipeFragment extends DialogFragment {
private View mRootView;
private int mPosition;
private List<ResourceModel> mResourceList;
private QuestionSwipePagerAdapter mQuestionSwipePagerAdapter;
private ViewPager mPager;
private int mSelectedChapterId;
private int mSelectedSectionId;
private int mSelectedSubSectionId;
private boolean mSelectedFavourite;
private boolean mIsFavourite;
private boolean mIsPagination;
private int mCurrentPage;
private int mTotalPage;
int mResourcePageNo;
int mMarkId;
int mDifficulties;
private int mFragmentType;
private int mFragType;
private PaginationParams mPaginationParams = new PaginationParams();
private static final int RESOURCE_ALL = -1;
private boolean onDestroy = false;
private static final String API_TYPE_PAGINATION = "pagination";
public QuestionSwipeFragment() {
// Required empty public constructor
}
public static DialogFragment newInstance(List<ResourceModel> mResourceList, int id, int fragType, boolean isFavourited, boolean isPaginationRequest,
int chapterId, int sectionId,
int resourcePageNo, int markId,
int difficulties, int currentPage,
int totalPage) {
Bundle bundle = new Bundle();
QuestionSwipeFragment fragment = new QuestionSwipeFragment();
bundle.putParcelableArrayList(Constants.QUESTION_SWIPE_RESOURCE_LIST, (ArrayList<? extends Parcelable>) mResourceList);
bundle.putInt(Constants.QUESTION_SWIPE_RESOURCE_LIST_POSTION, id);
bundle.putInt(Constants.QUESTION_SWIPE_TYPE_FRAGMENT, fragType);
bundle.putBoolean(Constants.QUESTION_SWIPE_ISFAVOURITED, isFavourited);
bundle.putBoolean(Constants.QUESTION_SWIPE_ISPAGINATIONREQUEST, isPaginationRequest);
bundle.putInt(Constants.QUESTION_SWIPE_SELECTED_CHAPTER_ID, chapterId);
bundle.putInt(Constants.QUESTION_SWIPE_SELECTED_SECTION_ID, sectionId);
bundle.putInt(Constants.QUESTION_SWIPE_RESOURCEPAGE_NO, resourcePageNo);
bundle.putInt(Constants.QUESTION_SWIPE_MARKID, markId);
bundle.putInt(Constants.QUESTION_SWIPE_DIFFICULTIES, difficulties);
bundle.putInt(Constants.QUESTION_SWIPE_CURRENTPAGE, currentPage);
bundle.putInt(Constants.QUESTION_SWIPE_TOTALPAGE, totalPage);
fragment.setArguments(bundle);
return fragment;
}
public static DialogFragment newInstance(List<ResourceModel> mResourceList, int position, int fragType,
int selectedChapterId, int selectedSectionId, int selectedSubSectionId, int currentPage, int totalPage) {
Bundle bundle = new Bundle();
QuestionSwipeFragment fragment = new QuestionSwipeFragment();
bundle.putParcelableArrayList(Constants.QUESTION_SWIPE_RESOURCE_LIST, (ArrayList<? extends Parcelable>) mResourceList);
bundle.putInt(Constants.QUESTION_SWIPE_RESOURCE_LIST_POSTION, position);
bundle.putInt(Constants.QUESTION_SWIPE_TYPE_FRAGMENT, fragType);
bundle.putInt(Constants.QUESTION_SWIPE_SELECTED_CHAPTER_ID, selectedChapterId);
bundle.putInt(Constants.QUESTION_SWIPE_SELECTED_SECTION_ID, selectedSectionId);
bundle.putInt(Constants.QUESTION_SWIPE_SELECTED_SUBSECTION_ID, selectedSubSectionId);
bundle.putInt(Constants.QUESTION_SWIPE_CURRENTPAGE, currentPage);
bundle.putInt(Constants.QUESTION_SWIPE_TOTALPAGE, totalPage);
bundle.putInt(Constants.QUESTION_SWIPE_CURRENTFRAGMENT, fragType);
fragment.setArguments(bundle);
return fragment;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
handleBundle(getArguments());
setStyle(DialogFragment.STYLE_NORMAL, R.style.MyMaterialTheme);
}
//the below method is causing IllegalArgumentException
private void handleBundle(Bundle bundle) {
if (bundle != null) {
if (bundle.containsKey(Constants.QUESTION_SWIPE_RESOURCE_LIST)) {
mResourceList = bundle.getParcelableArrayList(Constants.QUESTION_SWIPE_RESOURCE_LIST);
mPosition = bundle.getInt(Constants.QUESTION_SWIPE_RESOURCE_LIST_POSTION);
mFragType = bundle.getInt(Constants.QUESTION_SWIPE_TYPE_FRAGMENT);
mSelectedChapterId = bundle.getInt(Constants.QUESTION_SWIPE_SELECTED_CHAPTER_ID);
mSelectedSectionId = bundle.getInt(Constants.QUESTION_SWIPE_SELECTED_SECTION_ID);
mSelectedSubSectionId = bundle.getInt(Constants.QUESTION_SWIPE_SELECTED_SUBSECTION_ID);
mIsFavourite = bundle.getBoolean(Constants.QUESTION_SWIPE_ISFAVOURITED);
mIsPagination = bundle.getBoolean(Constants.QUESTION_SWIPE_ISPAGINATIONREQUEST);
mCurrentPage = bundle.getInt(Constants.QUESTION_SWIPE_CURRENTPAGE);
mTotalPage = bundle.getInt(Constants.QUESTION_SWIPE_TOTALPAGE);
mResourcePageNo = bundle.getInt(Constants.QUESTION_SWIPE_RESOURCEPAGE_NO);
mMarkId = bundle.getInt(Constants.QUESTION_SWIPE_MARKID);
mDifficulties = bundle.getInt(Constants.QUESTION_SWIPE_DIFFICULTIES);
mFragmentType = bundle.getInt(Constants.QUESTION_SWIPE_CURRENTFRAGMENT);
}
}
}
And below is the code where i am starting this fragment from adapter
private void setonClickListeners(ResourceQuestionsViewHolder viewHolder, final int position) {
viewHolder.mContainerView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DialogFragment questionSwipeFragment = QuestionSwipeFragment.newInstance(getExtractResourceInfo(position).getExtractedList(), getExtractResourceInfo(position).getPosition(), Constants.QB_DETAILS_FRAGMENT, isFavourited, isPaginationRequest, chapterId, sectionId, resourcePageNo, markId, difficulties, mCurrentPage, mTotalPage);
questionSwipeFragment.show(((QuestionBankActivity) mContext).getSupportFragmentManager(), "dialog");
}
});
}
private void setonLongClickListener(SubSectionResourceQuestionsViewHolder viewHolder, final int position) {
viewHolder.mContainerView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
DialogFragment questionBankFragment = QBSubSectionDetailFragment.newInstance(mResourceList, false, position);
questionBankFragment.show(((SynopsisActivity) mContext).getSupportFragmentManager(), "dialog");
return true;
}
});
}
from Android java.lang.IllegalArgumentException: Duplicate key in ArrayMap: null
No comments:
Post a Comment