Ejemplo n.º 1
0
 /////////////
 // getters //
 /////////////
 public static PBMediaStore getMediaStore() {
   try {
     return preferenceFragment.getService().getMediaStore();
   } catch (Exception e) {
     return null;
   }
 }
Ejemplo n.º 2
0
  @Override
  public void onRequestPermissionsResult(
      int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);

    if (requestCode == PBPreferenceFragment.PERMISSION_READ_EXTERNAL_STORAGE) {
      if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
        Log.i("PBPreferenceFragment", "READ_EXTERNAL_STORAGE permission granted.");
        preferenceFragment.testMediaSender(); // continue to next step
      } else {
        Log.i("PBPreferenceFragment", "READ_EXTERNAL_STORAGE was NOT granted.");
        Toast.makeText(this, R.string.toast_permission_not_granted, Toast.LENGTH_LONG).show();
      }
    }
  }