Account[] accounts=AccountManager.get(this).getAccountsByType("com.google"); String myEmailid=accounts[0].toString(); Log.d("My email id that i want", myEmailid); for(Account account: accounts) { String possibleEmail=account.toString(); Log.d("Possible email id of user", possibleEmail); }
public String toString() { String s = ""; for (Account account:accountList){ s += account.toString() + "\n"; } return s; }
Account account = //... System.out.println(account); output.setText(account.toString());
private static final String ACCOUNT_TYPE_GOOGLE = "com.google"; private static final String[] FEATURES = { "service_mail","service_cl","service_sitemaps" }; private void testGetAccountsByTypeAndFeatures() { AccountManagerFuture<Account[]> accounts = AccountManager.get(this).getAccountsByTypeAndFeatures(ACCOUNT_TYPE_GOOGLE, FEATURES, new AccountManagerCallback<Account[]>() { @Override public void run(AccountManagerFuture<Account[]> future) { try { for (Account account : future.getResult()) { Log.d("ACCOUNT",account.toString()); } } catch (OperationCanceledException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (AuthenticatorException e) { e.printStackTrace(); } } }, null); }
@RequestMapping(value = "/getAccounts", method = RequestMethod.GET) public @ResponseBody List<DisplayAccount> listAccounts(@RequestParam String name, HttpServletResponse response) { response.setContentType("application/json"); List<Account> all_accountr = accountRepo.findAll(); List<DisplayAccount> result = new ArrayList<DisplayAccount>(); for (Account account : all_accountr) { if (StringUtils.containsIgnoreCase(account.toString(), name)) { DisplayAccount s_account = new DisplayAccount(account); result.add(s_account); } } return result; }
public String showBefore( Date prevDate) { StringBuilder builder = new StringBuilder(""); for ( int i = 0; i < size(); i++) { Account account = bank[i]; if (account != null) { Date date = account.getDate(); if (date != null && date.compareTo(prevDate) == -1 ) { builder.append(account.toString() + "\n") } } } return builder.toString(); }
protected void checkAccount(Account account) { assert account.getId() != null : account; assertEquals(account.toString(), client.getAccountClient().getAccount(account.getId()).toString()); assert account.getName() != null : account; assert account.getType() != null && account.getType() != Account.Type.UNRECOGNIZED : account;
protected void checkAccount(Account account) { assert account.getId() != null : account; assertEquals(account.toString(), client.getAccountApi().getAccount(account.getId()).toString()); assert account.getName() != null : account; assert account.getType() != null && account.getType() != Account.Type.UNRECOGNIZED : account;