add check if getActivity() == null#151
Open
bso112 wants to merge 1 commit intoParkSangGwon:masterfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TedBottomPicker uses ProxyActivity. and ProxyActivity stores ActivityRequest.
So if configuration change occurs, ActivityRequest's OnActivityResultListener reference destroyed TedBottomSheetDialogFragment.
This causes runtime Exception.
Failure delivering result ResultInfo{who=null, request=3457, result=-1, data=Intent { dat=content://media/external/images/media/7356 flg=0x1 (has extras) }} to activity {com.sample.android.demo/com.gun0912.tedonactivityresult.ProxyActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object referenceYou can demonstrate this problem by enabling 'Don't keep activities' on the Developer Options In Android Phone Setting.
To solve this problem, we can either check getActivity() != null when invoking onActivityResult() or make ProxyActivity doesn't stores ActivityRequest. The former will skip processing the Activity result, but Runtime Exception will not occur. The Latter takes so many changes. So, I choose the former.