Programmatically starting the 'Add Account' activity in Android 2.2

前端 未结 6 1373
耶瑟儿~
耶瑟儿~ 2020-12-16 19:47

I\'ve been experimenting with the Android SDK over the past few days, in readiness to write an App for the store, however I\'ve run across a bit of a problem.

The Ap

6条回答
  •  感动是毒
    2020-12-16 20:00

    the answer for the above question by providing EXTRA_ACCOUNT_TYPES in the intent extra data. and set the value to "com.google" in order to alert the activity:

    public static void startAddGoogleAccountIntent(Context context){
    Intent addAccountIntent = new Intent(android.provider.Settings.ACTION_ADD_ACCOUNT)
    .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    addAccountIntent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, new String[] {"com.google"});
    context.startActivity(addAccountIntent); }
    

提交回复
热议问题