There is an existing account on the phone that is used for a sync service. The account has some settings that the user entered when he created the account. Theses settings are stored as user data (--> mAccountManager.addAccountExplicitly(account, mPassword, userData)
).
The user should be able to change these settings. How can this be achieved? Do I need a standalone app to change existing account data?
I guess the user would go to 'Se开发者_StackOverflowttings'/'Accounts and sync'/'myAccount' and should find a menu entry like 'modify account data'. This menu entry should open the same activity that the user has already used to enter the data initially.
Any hints to push me in the right direction?
This fooled me for a while too - I expected to find getUserData()/setUserData() methods on the Account class, but they are on the AccountManager instead:
AccountManager am = AccountManager.get(context);
String myData = am.getUserData(account, SomeClass.MY_DATA_KEY);
myData = "Some New Value";
am.setUserData(account, SomeClass.MY_DATA_KEY, myData);
Check out the AccountManager setUserData method docs for more information.
Cheers, Andrew.
精彩评论