本文整理汇总了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();
}
}