我收到此错误
由java.lang.IllegalArgumentException引起:重复键入 ArrayMap:null
不在我当前的设备中,但它来自crashlytics,但我无法在我自己的设备中重新尝试所有可能的方法,但无法在我的设备中得到同样的错误,下面是我的代码,答案将非常感谢。
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);
}
}
}
以下是我从适配器
启动此片段的代码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;
}
});
}