Skip to content
This repository has been archived by the owner on Apr 30, 2020. It is now read-only.

AsyncTasks in MaterialAccount should not be instanciated at class initialization #143

Closed
mlumeau opened this issue Jan 28, 2015 · 2 comments

Comments

@mlumeau
Copy link

mlumeau commented Jan 28, 2015

When manipulating a MaterialAccount, it can happen that setPhoto() is called twice in a short timespan. In that case, an IllegalStateException is thrown, because you cannot execute the same instance of an AsyncTask while it is already executing.

A workaround would be to define AsyncTask inner classes of MaterialAccount (ResizePhotoBitmapAsyncTask, ResizeBackgroundBitmapAsyncTask...) and define setPhotoBitmap, setBackgroundBitmap, etc... as the following:

public void setPhoto(Bitmap photo) {
    new ResizePhotoBitmapAsyncTask().execute(photo);
} `
neokree pushed a commit that referenced this issue Jan 30, 2015
fixed #147 issue
added test for #143
@neokree
Copy link
Owner

neokree commented Jan 30, 2015

I followed your suggestion and committed now a little fix, please check if now the problem is resolved.

@mlumeau
Copy link
Author

mlumeau commented Feb 5, 2015

That did it. Everything runs perfectly with your fix.
Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants