當前位置: 首頁>>代碼示例>>Java>>正文


Java Activity.startIntentSenderForResult方法代碼示例

本文整理匯總了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;
    }
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:18,代碼來源:ShortcutConfigActivityInfo.java

示例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();
    }
}
 
開發者ID:mkeresztes,項目名稱:AndiCar,代碼行數:24,代碼來源:PreferenceActivity.java


注:本文中的android.app.Activity.startIntentSenderForResult方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。