Obsolete
Status Update
Comments
ad...@gmail.com <ad...@gmail.com> #2
I found the root cause! The fragment savedstate class uses a null class loader. Come on, that's Android 101! The correct creator should be:
public static final Parcelable.Creator<SavedState> CREATOR
= new Parcelable.Creator<SavedState>() {
@Override
public SavedState createFromParcel(Parcel in) {
return new SavedState(in, getClass().getClassLoader()); // <------
}
@Override
public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
For wondering how to fix this, reflection will do the trick:
// TODOhttps://issuetracker.google.com/issues/74354091
val fragmentStateField: Field = Fragment.SavedState::class.java
.getDeclaredField("mState").apply {
isAccessible = true
}
// ...
(fragmentStateField.get(savedState) as Bundle).classLoader = javaClass.classLoader
public static final Parcelable.Creator<SavedState> CREATOR
= new Parcelable.Creator<SavedState>() {
@Override
public SavedState createFromParcel(Parcel in) {
return new SavedState(in, getClass().getClassLoader()); // <------
}
@Override
public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
For wondering how to fix this, reflection will do the trick:
// TODO
val fragmentStateField: Field = Fragment.SavedState::class.java
.getDeclaredField("mState").apply {
isAccessible = true
}
// ...
(fragmentStateField.get(savedState) as Bundle).classLoader = javaClass.classLoader
lv...@gmail.com <lv...@gmail.com> #3
Thank you for reporting this issue. For us to further investigate this issue, please provide the following additional information:
Android bug report
After reproducing the issue, press the volume up, volume down, and power button simultaneously. This will capture a bug report on your device in the “bug reports” directory. Attach the bug report file to this issue.
Alternate method:
After reproducing the issue, navigate to developer settings, ensure ‘USB debugging’ is enabled, then enable ‘Bug report shortcut’. To take bug report, hold the power button and select the ‘Take bug report’ option.
Android bug report
After reproducing the issue, press the volume up, volume down, and power button simultaneously. This will capture a bug report on your device in the “bug reports” directory. Attach the bug report file to this issue.
Alternate method:
After reproducing the issue, navigate to developer settings, ensure ‘USB debugging’ is enabled, then enable ‘Bug report shortcut’. To take bug report, hold the power button and select the ‘Take bug report’ option.
al...@android.com <al...@android.com> #4
Please provide the information requested in comment #3 to investigate this issue further.
lb...@gmail.com <lb...@gmail.com> #5
al...@android.com <al...@android.com> #6
nabrozidhs@, can you please provide the android bug report to confirm that is duplicate or not.
lb...@gmail.com <lb...@gmail.com> #7
You can see it on the issue link I posted on the previous email. Checking the stack trace both go through a ViewPager/FragmentStatePagerAdapter before failing on the same issue.
al...@android.com <al...@android.com> #8
Because there is not enough information here for this issue to be actionable. See #3.
lb...@gmail.com <lb...@gmail.com> #9
@7 The bug itself doesn't have a scenario. Only clues. If it's still on newest version, there won't be any difference, and it will be exactly like here.
u....@gmail.com <u....@gmail.com> #10
It is a shame this has been marked as Obsolete without proper investigation.
As #8 stated, there is no definite scenario or way to reproduce the crash. If the issue is not fixed in the latest library then it will be same as here. Btw is there any changelog / fixlog available for the latest support library to check if something related to this has been patched?
I am also seeing several crash reports on my fabric dashboard and I have no clue what is wrong! (All fragment transactions are happening inside button onclickevents)
As #8 stated, there is no definite scenario or way to reproduce the crash. If the issue is not fixed in the latest library then it will be same as here. Btw is there any changelog / fixlog available for the latest support library to check if something related to this has been patched?
I am also seeing several crash reports on my fabric dashboard and I have no clue what is wrong! (All fragment transactions are happening inside button onclickevents)
lv...@gmail.com <lv...@gmail.com> #11
@8 @9 have you tried the reproduction steps I mentioned in #2. Unfortunately I haven't had the resources to try upgrading the library.
se...@gmail.com <se...@gmail.com> #12
Same issue here. Fabric reports 99 crashes for 82 users in many onClick and onItemClick callback. That's an example:
Fatal Exception: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1493)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1511)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:638)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:617)
at ####.setFragment(###.java:326)
at ####.onItemClick(###.java:169)
at android.widget.AdapterView.performItemClick(AdapterView.java:334)
at android.widget.AbsListView.performItemClick(AbsListView.java:1536)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3683)
at android.widget.AbsListView$3.run(AbsListView.java:5604)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6145)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Fatal Exception: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1493)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1511)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:638)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:617)
at ####.setFragment(###.java:326)
at ####.onItemClick(###.java:169)
at android.widget.AdapterView.performItemClick(AdapterView.java:334)
at android.widget.AbsListView.performItemClick(AbsListView.java:1536)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3683)
at android.widget.AbsListView$3.run(AbsListView.java:5604)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6145)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
n....@gmail.com <n....@gmail.com> #13
I've reproduced the issue on a sample project using the latest support library version.
https://github.com/ncantelmo/android-fragment-commit-crash
To get the app to crash, your best bet is to use a physical device and follow the steps mentioned by #2. I've been able to get it to crash maybe 10% of the time on my N5 doing so.
I set up the sample project to include a FAB and a single-item listview, both of which handle taps in the same way. Interestingly, I have not been able to get the app to crash using the FAB, but holding the listview item followed by the home button will work if the timing is right.
The sample code is using a Handler to dispatch the fragment transaction commits, but I haven't checked whether this is necessary to cause the issue. I would expect not, give some of the other stack traces that have been posted. Also, adding an animation to the transaction does not appear to affect whether or not the app crashes.
Thanks to everyone who posted regarding this issue, especially #2 for the steps to reproduce.
To get the app to crash, your best bet is to use a physical device and follow the steps mentioned by #2. I've been able to get it to crash maybe 10% of the time on my N5 doing so.
I set up the sample project to include a FAB and a single-item listview, both of which handle taps in the same way. Interestingly, I have not been able to get the app to crash using the FAB, but holding the listview item followed by the home button will work if the timing is right.
The sample code is using a Handler to dispatch the fragment transaction commits, but I haven't checked whether this is necessary to cause the issue. I would expect not, give some of the other stack traces that have been posted. Also, adding an animation to the transaction does not appear to affect whether or not the app crashes.
Thanks to everyone who posted regarding this issue, especially #2 for the steps to reproduce.
lb...@gmail.com <lb...@gmail.com> #15
@13 Please also fix it in general, and not just in this case.
hy...@gmail.com <hy...@gmail.com> #16
It works if you call DialogFragment from Fragment
fragmentView.post(() -> {
FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
YourDialog yourDialog = YourDialog.newInstance();
yourDialog.show(ft, "cannotGetLocationDialog");
});
fragmentView.post(() -> {
FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
YourDialog yourDialog = YourDialog.newInstance();
yourDialog.show(ft, "cannotGetLocationDialog");
});
lb...@gmail.com <lb...@gmail.com> #17
I've created a new library that's supposed to overcome this, by avoiding using Fragment altogether :
https://github.com/AndroidDeveloperLB/DialogShard
ch...@gmail.com <ch...@gmail.com> #18
I am getting same issue here,
W/System.err: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1533)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1551)
at android.support.v4.app.FragmentManagerImpl.popBackStack(FragmentManager.java:629)
at com.myapp.HomeActivity.removeAllBackEntries(HomeActivity.java:189)
at com.myapp.HomeActivity.onClickMyOrder(HomeActivity.java:113)
at com.myapp.HomeActivity.access$300(HomeActivity.java:50)
at com.myapp.HomeActivity$3.onTabSelected(HomeActivity.java:327)
at com.aurelhubert.ahbottomnavigation.AHBottomNavigation.updateItems(AHBottomNavigation.java:527)
at com.aurelhubert.ahbottomnavigation.AHBottomNavigation.setCurrentItem(AHBottomNavigation.java:1088)
at com.aurelhubert.ahbottomnavigation.AHBottomNavigation.setCurrentItem(AHBottomNavigation.java:1072)
at com.myapp.HomeActivity.onClickonPostOrderSuccess(HomeActivity.java:522)
at com.myapp.order.OrderNowActivity$10.onClick(OrderNowActivity.java:427)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
W/System.err: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1533)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1551)
at android.support.v4.app.FragmentManagerImpl.popBackStack(FragmentManager.java:629)
at com.myapp.HomeActivity.removeAllBackEntries(HomeActivity.java:189)
at com.myapp.HomeActivity.onClickMyOrder(HomeActivity.java:113)
at com.myapp.HomeActivity.access$300(HomeActivity.java:50)
at com.myapp.HomeActivity$3.onTabSelected(HomeActivity.java:327)
at com.aurelhubert.ahbottomnavigation.AHBottomNavigation.updateItems(AHBottomNavigation.java:527)
at com.aurelhubert.ahbottomnavigation.AHBottomNavigation.setCurrentItem(AHBottomNavigation.java:1088)
at com.aurelhubert.ahbottomnavigation.AHBottomNavigation.setCurrentItem(AHBottomNavigation.java:1072)
at com.myapp.HomeActivity.onClickonPostOrderSuccess(HomeActivity.java:522)
at com.myapp.order.OrderNowActivity$10.onClick(OrderNowActivity.java:427)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
an...@gmail.com <an...@gmail.com> #19
[Comment deleted]
an...@gmail.com <an...@gmail.com> #20
I am also getting same issue here on 2 page , I have extended my Activity with FragmentActivity, I am not doing any fragment transactions , it comes on pressing back button
Fatal Exception: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(SourceFile:1533)
at android.support.v4.app.FragmentManagerImpl.popBackStackImmediate(SourceFile:603)
at android.support.v4.app.FragmentActivity.onBackPressed(SourceFile:179)
at com.syntonic.freeway.android.ui.VerificationActivity.onBackPressed(SourceFile:439)
at android.app.Activity.onKeyUp(Activity.java:2199)
at android.view.KeyEvent.dispatch(KeyEvent.java:2664)
at android.app.Activity.dispatchKeyEvent(Activity.java:2441)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1996)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:3909)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3883)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3416)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3466)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3435)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3542)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3443)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3599)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3416)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3466)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3435)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3443)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3416)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3466)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3435)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3575)
at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:3759)
at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2056)
at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:1750)
at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:1741)
at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2033)
at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:138)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:5372)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:970)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:786)
at dalvik.system.NativeStart.main(NativeStart.java)
lb...@gmail.com <lb...@gmail.com> #21
This crash occurs on at least 3 cases I've found/reported about. That's why I decided to stop using this class and use normal dialogs instead, or use my own library that mimics DialogFragment in a similar way (here: https://github.com/AndroidDeveloperLB/DialogShard ) .
It crashes because of using fragments, which do not accept being added&committed in specific activity lifecycle times.
Since those bugs are so old, I recommend you all to do the same.
It crashes because of using fragments, which do not accept being added&committed in specific activity lifecycle times.
Since those bugs are so old, I recommend you all to do the same.
el...@gmail.com <el...@gmail.com> #22
I've got the same problem here.
The way to reproduce the problem just click home button before showing the the DialogFragment.
The crash might happen because the DialogFragment is trying to show when your app is in background and DialogFragment is not supposed to shown when the app is in background.
in my case I tried to show pop up after hit API.
```Java
new JsonHttpResponseHandler() {
...
dialog.show()
...
}
```
my bandaid:
```Java
new JsonHttpResponseHandler() {
...
if (App.isInBackground) return; // App is Application extended class
dialog.show()
...
}
```
This is how I prevent the crash of DialogFragment.show after onSaveInstanceState
The way to reproduce the problem just click home button before showing the the DialogFragment.
The crash might happen because the DialogFragment is trying to show when your app is in background and DialogFragment is not supposed to shown when the app is in background.
in my case I tried to show pop up after hit API.
```Java
new JsonHttpResponseHandler() {
...
dialog.show()
...
}
```
my bandaid:
```Java
new JsonHttpResponseHandler() {
...
if (App.isInBackground) return; // App is Application extended class
dialog.show()
...
}
```
This is how I prevent the crash of DialogFragment.show after onSaveInstanceState
u....@gmail.com <u....@gmail.com> #23
This has been reported a long time ago. Can we expect a fix any time soon?
na...@gmail.com <na...@gmail.com> #24
Here's a quick fix that works for me,
show the dialog fragment from a Handler:
new Handler().post(new Runnable()
{
@Override
public void run ()
{
dialogFragment.show(getSupportFragmentManager(), null);
}
});
PS: This issue is only happen on my Marshmallow device though.
In my case, this bug is reproducible when you ask for a permission, then you show a dialog fragment right after that permission is granted.
show the dialog fragment from a Handler:
new Handler().post(new Runnable()
{
@Override
public void run ()
{
dialogFragment.show(getSupportFragmentManager(), null);
}
});
PS: This issue is only happen on my Marshmallow device though.
In my case, this bug is reproducible when you ask for a permission, then you show a dialog fragment right after that permission is granted.
lb...@gmail.com <lb...@gmail.com> #25
@24 This won't always work. I saw cases that it will still crash. Not on this case specifically, but similar cases, with loaders.
rg...@gmail.com <rg...@gmail.com> #26
We can fix it by override show() method, before show the dialogFragment we suddenly press the home button at the time it may be happen .
public int show(FragmentTransaction transaction, String tag) {
mDismissed = false;
mShownByMe = true;
transaction.add(this, tag);
mViewDestroyed = false;
mBackStackId = transaction.commit(); // it is the reason for illegalstateException .
return mBackStackId;
}
can you
@override
show(){
mDismissed = false;
mShownByMe = true;
transaction.add(this, tag);
mViewDestroyed = false;
mBackStackId = transaction.commitAllowingStateLoss(); // it is the solution
return mBackStackId;
}
public int show(FragmentTransaction transaction, String tag) {
mDismissed = false;
mShownByMe = true;
transaction.add(this, tag);
mViewDestroyed = false;
mBackStackId = transaction.commit(); // it is the reason for illegalstateException .
return mBackStackId;
}
can you
@override
show(){
mDismissed = false;
mShownByMe = true;
transaction.add(this, tag);
mViewDestroyed = false;
mBackStackId = transaction.commitAllowingStateLoss(); // it is the solution
return mBackStackId;
}
al...@gmail.com <al...@gmail.com> #27
Hello. I know very good workaround. Just put this into all your activities:
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
...
//https://issuetracker.google.com/issues/37094575
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
findViewById(R.id.some_very_top_view_id).cancelPendingInputEvents();
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
...
//
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
findViewById(R.id.some_very_top_view_id).cancelPendingInputEvents();
}
}
wi...@wylas-timing.com <wi...@wylas-timing.com> #28
A more generic solution to #27 is:
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
final View rootView = findViewById(android.R.id.content);
if (rootView != null) {
rootView.cancelPendingInputEvents();
}
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
final View rootView = findViewById(android.R.id.content);
if (rootView != null) {
rootView.cancelPendingInputEvents();
}
}
}
lb...@gmail.com <lb...@gmail.com> #29
One new example of this that I've found:
onClick of a preference, that shows a DialogFragment.
Occurs on this library:
https://github.com/jaredrummler/ColorPicker/issues
Reported here:
https://github.com/jaredrummler/ColorPicker/issues/57
And also on Firebase Crashlytics (attached screenshot).
onClick of a preference, that shows a DialogFragment.
Occurs on this library:
Reported here:
And also on Firebase Crashlytics (attached screenshot).
il...@google.com <il...@google.com> #30
lb...@gmail.com <lb...@gmail.com> #31
@30 Sadly nobody should use this, as it has its own serious issues, including 1.1.0-alpha02
ma...@gmail.com <ma...@gmail.com> #32
The stable version 1.1.0 works fine for me, and solves this issue.
Description
Library used (support-v4, appcompat-v7, ...):
Version used:
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
Theme used:
default one
Devices/Android versions reproduced on:
According to Crashlytics:
- Samsung (76%) : SM G900F, SM G925F, SM G920F, ...
- LG (4%) : D855, Nexus 5, H815, ...
- HTC (3%) : HTC One, Desire 626S, Desire 820
- others.
Android versions:
-Android 5 (76%) : 5.1.1, 5.0, 5.0.2 , ...
-Android 4 (16%) : 4.4.2, 4.4.4, 4.3, ...
-Android 6 (8%) : 6.0, 6.0.1 .
- Relevant code to trigger the issue.
A fragment within a fragment that's a page of an activity's ViewPager, with an onClickListener on a view, calling:
someDialogFragment.show(activity, SomeDialogFragment.TAG);
crash logs:
Fatal Exception: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1493)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1511)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:634)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:613)
at android.support.v4.app.DialogFragment.show(DialogFragment.java:139)
at ...DialogFragmentCompatEx.show(DialogFragmentCompatEx.java:61)
at ...SomeDialogFragment.show(Dialogs.java:528)
at ...onClick(SomeFragment.java:540)
at android.view.View.performClick(View.java:4789)
at android.view.View$PerformClick.run(View.java:19881)
at android.os.Handler.handleCallback(Handler.java:739)
I've even tried to check if the fragment is added and that the activity is still alive (!isFinishing&&!isDestroyed), but it didn't work