Code example for AccountManager

Methods: addAccount

0
     * If something goes wrong -the RESULT_CANCELED flag is set, an Intent with 
     * a message is sent to the caller's onActivityResult() method and the 
     * activity is destroyed. 
     */ 
    public void onClick(final View v) {
	this.mAccountManager.addAccount("com.google", null, null,
		null /* options */, this,
		new AddGoogleAccountManagerCallback(), null /* handler */); 
 
    } 
 
    public void onAccountsUpdated(final Account[] accounts) {
 
        this.mAccountsListView.setAdapter(new AccountArrayAdapter(this, accounts));
    } 
 
}