Skip to content

Commit

Permalink
#784 - The context received in the onAttach method is not always an A…
Browse files Browse the repository at this point in the history
…ctivity context so a check was added to make sure that the correct context is being passed (#804)
  • Loading branch information
TomerPacific authored and Swati4star committed Oct 8, 2019
1 parent d14e439 commit 7524176
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,12 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
@Override
public void onAttach(Context context) {
super.onAttach(context);
mActivity = (Activity) context;
if (context instanceof Activity) {
mActivity = (Activity) context;
} else {
mActivity = getActivity();
}

mFileUtils = new FileUtils(mActivity);
mDirectoryUtils = new DirectoryUtils(mActivity);
}
Expand Down

0 comments on commit 7524176

Please sign in to comment.