Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit bf3cd48

Browse files
authored
Changed getContext() to requireContext(), to ensure it is not null. (#309)
1 parent 4f4d305 commit bf3cd48

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/src/main/java/pub/devrel/easypermissions/sample/MainFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class MainFragment extends Fragment implements EasyPermissions.Permission
2525
private static final int RC_SMS_PERM = 122;
2626

2727
@Override
28-
public View onCreateView(LayoutInflater inflater,
28+
public View onCreateView(@NonNull LayoutInflater inflater,
2929
ViewGroup container,
3030
Bundle savedInstanceState) {
3131
super.onCreateView(inflater, container, savedInstanceState);
@@ -51,7 +51,7 @@ public void onRequestPermissionsResult(int requestCode,
5151

5252
@AfterPermissionGranted(RC_SMS_PERM)
5353
private void smsTask() {
54-
if (EasyPermissions.hasPermissions(getContext(), Manifest.permission.READ_SMS)) {
54+
if (EasyPermissions.hasPermissions(requireContext(), Manifest.permission.READ_SMS)) {
5555
// Have permission, do the thing!
5656
Toast.makeText(getActivity(), "TODO: SMS things", Toast.LENGTH_LONG).show();
5757
} else {

0 commit comments

Comments
 (0)