本文整理匯總了Java中android.app.Dialog.BUTTON_POSITIVE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Dialog.BUTTON_POSITIVE屬性的具體用法?Java Dialog.BUTTON_POSITIVE怎麽用?Java Dialog.BUTTON_POSITIVE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.app.Dialog
的用法示例。
在下文中一共展示了Dialog.BUTTON_POSITIVE屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onClick
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == Dialog.BUTTON_POSITIVE) {
if (mHost instanceof Fragment) {
((Fragment) mHost).requestPermissions(mConfig.permissions, mConfig.requestCode);
} else if (mHost instanceof android.app.Fragment) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
((android.app.Fragment) mHost)
.requestPermissions(mConfig.permissions, mConfig.requestCode);
} else {
throw new IllegalArgumentException(
"Target SDK needs to be greater than 23 if caller is android.app.Fragment");
}
} else if (mHost instanceof FragmentActivity) {
ActivityCompat.requestPermissions(
(FragmentActivity) mHost, mConfig.permissions, mConfig.requestCode);
}
} else {
notifyPermissionDenied();
}
}
示例2: onClick
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == Dialog.BUTTON_POSITIVE) {
EasyPermissions.executePermissionsRequest(mHost,
mConfig.permissions, mConfig.requestCode);
} else {
notifyPermissionDenied();
}
}