本文整理了Java中androidx.fragment.app.Fragment.onRequestPermissionsResult()
方法的一些代码示例,展示了Fragment.onRequestPermissionsResult()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Fragment.onRequestPermissionsResult()
方法的具体详情如下:
包路径:androidx.fragment.app.Fragment
类名称:Fragment
方法名:onRequestPermissionsResult
暂无
代码示例来源:origin: googlesamples/easypermissions
@Override
public void onRequestPermissionsResult(int requestCode,
@NonNull String[] permissions,
@NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
// EasyPermissions handles the request result.
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
}
代码示例来源:origin: trello/navi
@Override @CallSuper public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
base.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
代码示例来源:origin: y20k/transistor
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case PERMISSION_REQUEST_STATION_FETCHER_READ_EXTERNAL_STORAGE: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// permission granted - fetch station from given Uri
fetchNewStation(mNewStationUri);
} else {
// permission denied
Toast.makeText(mActivity, mActivity.getString(R.string.toastalert_permission_denied) + " READ_EXTERNAL_STORAGE", Toast.LENGTH_LONG).show();
}
break;
}
}
}
代码示例来源:origin: morogoku/MTweaks-KernelAdiutorMOD
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
onPermissionGranted(requestCode);
} else {
onPermissionDenied(requestCode);
}
}
代码示例来源:origin: jruesga/rview
@Override
public void onRequestPermissionsResult(
int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
List<Fragment> fragments = getSupportFragmentManager().getFragments();
if (fragments != null) {
for (Fragment fragment : fragments) {
fragment.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
}
代码示例来源:origin: y20k/transistor
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case PERMISSION_REQUEST_IMAGE_PICKER_READ_EXTERNAL_STORAGE: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
selectFromImagePicker();
} else {
// permission denied
Toast.makeText(this, getString(R.string.toastalert_permission_denied) + " READ_EXTERNAL_STORAGE", Toast.LENGTH_LONG).show();
}
break;
}
case PERMISSION_REQUEST_STATION_FETCHER_READ_EXTERNAL_STORAGE: {
// let list fragment handle the request
Fragment listFragment = getSupportFragmentManager().findFragmentByTag(MAIN_ACTIVITY_FRAGMENT_TAG);
if (listFragment != null) {
listFragment.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
break;
}
}
}
代码示例来源:origin: esafirm/android-image-picker
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
break;
内容来源于网络,如有侵权,请联系作者删除!