Created
April 11, 2012 19:05
-
-
Save clholgat/2361467 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AlertDialog.Builder builder = new AlertDialog.Builder(this); | |
AccountManager mgr = AccountManager.get(this); | |
Account[] accts = mgr.getAccountsByType("com.google"); | |
final String[] items = new String[accts.length]; | |
for(int i = 0; i < accts.length; i++){ | |
items[i] = accts[i].name; | |
} | |
builder.setTitle("Choose Account To Log Into SilverBullet"); | |
builder.setItems(items, new DialogInterface.OnClickListener() { | |
public void onClick(DialogInterface dialog, int item) { | |
SharedPreferences.Editor editor = settings.edit(); | |
editor.putString("UserName", items[item]); | |
editor.commit(); | |
//Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show(); | |
} | |
}); | |
alert = builder.create(); | |
alert.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment