Ok, I'm getting an IllegalArgumentException
at a point where it shouldn't.
I have a custom extension of Account
that is saved using the AccountManager:
// Method inside a custom extension of Account
public boolean save(AccountManager manager) {
removeAll(manager);
boolean result = manager.addAccountExplicitly(this, null, toBundle());
manager.setUserData(this, KEY_1, value1);
manager.setUserData(this, KEY_2, value2);
manager.setUserData(this, KEY_3, value3);
return result;
}
The keys are constant String values but app still throws:
java.lang.IllegalArgumentException: key is null
I have to say that I'm only attaching the user data in this fashion because using:
manager.addAccountExplicitly(this, null, toBundle());
didn't seem to attach the values. Do the keys require a special name pattern?
Anybody had this problem before?
Update:
It gets thrown inside the manager.setUserData()
which looks like this (Android code):
public void setUserData(final Account account, final String key, final String value) {
if (account == null) throw new IllegalArgumentException("account is null");
if (key == null) throw new IllegalArgumentException("key is null");
try {
mService.setUserData(account, key, value);
} catch (RemoteException e) {
// won't ever happen
throw new RuntimeException(e);
}
}
When I "walk" into this method with eclipse I get this in the debug perspective:
The values aren't null >o<
setUserData
method I was providing the userData with the methodtoBundle()
but when retrieving the userData I got null values. – Forelli