本文整理匯總了Java中android.provider.Settings.ACTION_ADD_ACCOUNT屬性的典型用法代碼示例。如果您正苦於以下問題:Java Settings.ACTION_ADD_ACCOUNT屬性的具體用法?Java Settings.ACTION_ADD_ACCOUNT怎麽用?Java Settings.ACTION_ADD_ACCOUNT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.provider.Settings
的用法示例。
在下文中一共展示了Settings.ACTION_ADD_ACCOUNT屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onAddAccountClicked
public void onAddAccountClicked(View view) {
Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, new String[]{getString(R.string.account_type)});
}
startActivity(intent);
}
示例2: openAndroidAccountCreationScreen
/**
* Opens the Android account manager for adding or creating a Google account.
* @param applicationContext
*/
private static void openAndroidAccountCreationScreen(
Context applicationContext) {
logEvent(ProfileAccountManagementMetrics.DIRECT_ADD_ACCOUNT, GAIA_SERVICE_TYPE_SIGNUP);
Intent createAccountIntent = new Intent(Settings.ACTION_ADD_ACCOUNT);
createAccountIntent.putExtra(
EXTRA_ACCOUNT_TYPES, new String[]{EXTRA_VALUE_GOOGLE_ACCOUNTS});
createAccountIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
| Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
applicationContext.startActivity(createAccountIntent);
}
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:17,代碼來源:AccountManagementScreenHelper.java
示例3: createAddGoogleAccountIntent
private static Intent createAddGoogleAccountIntent() {
Intent createAccountIntent = new Intent(Settings.ACTION_ADD_ACCOUNT);
// NOTE: the documentation says Settings.EXTRA_AUTHORITIES should be used,
// but it doesn't work.
createAccountIntent.putExtra(
EXTRA_ACCOUNT_TYPES, new String[]{EXTRA_VALUE_GOOGLE_ACCOUNTS});
return createAccountIntent;
}
示例4: promptAddAccount
private void promptAddAccount() {
Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, new String[]{"com.google"});
startActivity(intent);
finish();
}
示例5: signInOrCreateAnAccount
private void signInOrCreateAnAccount() {
//Get list of accounts on device.
AccountManager am = AccountManager.get(BaseActivity.this);
Account[] accountArray = am.getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
if (accountArray.length == 0) {
//Send the user to the "Add Account" page.
Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES,
new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE});
startActivity(intent);
} else {
//Try to log the user in with the first account on the device.
startLoginProcess();
mDrawerLayout.closeDrawer(GravityCompat.START);
}
}