Don't touch views in the background.

Bug: 5404366
Change-Id: I8aca89c032db41aaf95d3a94dc8047fbacbd47a9
This commit is contained in:
Ben Komalo 2011-10-03 12:58:58 -07:00
parent 1d8302e88b
commit d75ac0d357

View File

@ -130,14 +130,20 @@ public class AccountSetupNames extends AccountSetupActivity implements OnClickLi
}
private void prefillNameFromProfile() {
EmailAsyncTask.runAsyncParallel(new Runnable() {
new EmailAsyncTask<Void, Void, String>(null) {
@Override
public void run() {
protected String doInBackground(Void... params) {
String[] projection = new String[] { Profile.DISPLAY_NAME };
mName.setText(Utility.getFirstRowString(
AccountSetupNames.this, PROFILE_URI, projection, null, null, null, 0));
return Utility.getFirstRowString(
AccountSetupNames.this, PROFILE_URI, projection, null, null, null, 0);
}
});
@Override
public void onSuccess(String result) {
// Views can only be modified on the main thread.
mName.setText(result);
}
}.executeParallel((Void[]) null);
}
/**