本文整理匯總了Java中android.app.Activity.startIntentSenderForResult方法的典型用法代碼示例。如果您正苦於以下問題:Java Activity.startIntentSenderForResult方法的具體用法?Java Activity.startIntentSenderForResult怎麽用?Java Activity.startIntentSenderForResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.app.Activity
的用法示例。
在下文中一共展示了Activity.startIntentSenderForResult方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startConfigActivity
import android.app.Activity; //導入方法依賴的package包/類
@Override
public boolean startConfigActivity(Activity activity, int requestCode) {
if (getUser().equals(Process.myUserHandle())) {
return super.startConfigActivity(activity, requestCode);
}
try {
Method m = LauncherApps.class.getDeclaredMethod(
"getShortcutConfigActivityIntent", LauncherActivityInfo.class);
IntentSender is = (IntentSender) m.invoke(
activity.getSystemService(LauncherApps.class), mInfo);
activity.startIntentSenderForResult(is, requestCode, null, 0, 0, 0);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
示例2: showGDriveFolderSelector
import android.app.Activity; //導入方法依賴的package包/類
private static void showGDriveFolderSelector(Activity activity) {
if (activity == null)
return;
OpenFileActivityBuilder openFileActivityBuilder = Drive.DriveApi
.newOpenFileActivityBuilder();
if (openFileActivityBuilder != null) {
IntentSender intentSender = openFileActivityBuilder.setActivityTitle(AndiCar.getAppResources().getString(R.string.pref_secure_backup_gdrive_folder_selector_title))
.setSelectionFilter(Filters.eq(SearchableField.MIME_TYPE, DriveFolder.MIME_TYPE))
.build(mGoogleApiClient);
try {
activity.startIntentSenderForResult(
intentSender, ConstantValues.REQUEST_OPEN_DRIVE_FOLDER, null, 0, 0, 0);
}
catch (IntentSender.SendIntentException e) {
Log.i("AndiCar", "Failed to launch file chooser.");
}
}
else {
Toast.makeText(activity, "Unable to open folder selector!", Toast.LENGTH_LONG).show();
}
}