Account Information

November 19, 2015 0 Comments

step 1:
<uses-permission android:name="android.permission.GET_ACCOUNTS" />

Step 2: // API level 8+
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
Account[] accounts = AccountManager.get(getApplicationContext()).getAccounts();
for (Account account : accounts) {
if (emailPattern.matcher(account.name).matches()) {
String possibleEmail = account.name;
Toast.makeText(getApplicationContext(), possibleEmail, Toast.LENGTH_SHORT).show();
}
}

Contributer

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard. Google

0 comments:

Popular Posts