Code example for AccountManager

Methods: getAccountsByType

0
	@Override 
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		 
		accountManager = AccountManager.get(getApplicationContext());
		Account[] accounts = accountManager.getAccountsByType("com.google");
		int layoutId = android.R.layout.simple_list_item_1;
		this.setListAdapter(new ArrayAdapter<Account>(this, layoutId, accounts));
	} 
 
	@Override 
	protected void onListItemClick(ListView l, View v, int position, long id) {
		Account account = (Account) getListView().getItemAtPosition(position);
		Intent intent = new Intent(this, AppInfo.class);
		intent.putExtra("account", account);
		startActivity(intent);
	} 
}