gpt4 book ai didi

android.support.v4.app.Fragment.setArguments(android.os.Bundle)' 在空对象引用上

转载 作者:行者123 更新时间:2023-11-29 14:16:37 24 4
gpt4 key购买 nike

在一些非常罕见的情况中,这条线路会发生崩溃:

mCurrentDialogFragment.get().setArguments(bundle);

protected void showDateTimePickerDialog() {
mCurrentDialogFragment = new WeakReference<AppCompatDialogFragment>(new DateTimePickerDialogFragment());
((DateTimePickerDialogFragment) mCurrentDialogFragment.get()).setOnDateTimeSelectedListener(
new DateTimePickerDialogFragment.OnDateTimeSelectedListener() {
@Override
public void onCancelled() {
}

@Override
public void onDateTimeSet(int year, int monthOfYear, int dayOfMonth,
int hourOfDay, int minute) {
...
});

DateTime dt = new DateTime(mCalendarTimeLineAdapter.convertPositionToMs(
mViewPager.getCurrentItem()));

if (mCurrentDialogFragment != null && mCurrentDialogFragment.get() != null) {
Pair<Boolean, SublimeOptions> optionsPair =
TimeUtils.getDateTimePickerOptionsForDiary(mScheduleRange,
new DateTime(dt), mCalendarTimeLineAdapter.getCalendarTodayPosition());

Bundle bundle = new Bundle();
bundle.putParcelable(DateTimePickerDialogFragment.BUNDLE_KEY_DATETIME_OPTIONS, optionsPair.second);

// **** CRASH HERE
mCurrentDialogFragment.get().setArguments(bundle);

mCurrentDialogFragment.get().setStyle(android.support.v4.app.DialogFragment.STYLE_NO_TITLE, 0);
mCurrentDialogFragment.get().show(getSupportFragmentManager(), TAG);
}
}

怎么可能?我不明白引用怎么可以为空...

大家有什么解释吗?

非常感谢

最佳答案

尝试初始化您的 Dialoig mCurrentDialogFragment = null 然后分配给它。

关于android.support.v4.app.Fragment.setArguments(android.os.Bundle)' 在空对象引用上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49314032/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com