{"action":"created","issue":{"url":"https://api.github.com/repos/neokree/MaterialNavigationDrawer/issues/143","labels_url":"https://api.github.com/repos/neokree/MaterialNavigationDrawer/issues/143/labels{/name}","comments_url":"https://api.github.com/repos/neokree/MaterialNavigationDrawer/issues/143/comments","events_url":"https://api.github.com/repos/neokree/MaterialNavigationDrawer/issues/143/events","html_url":"https://github.com/neokree/MaterialNavigationDrawer/issues/143","id":55777424,"number":143,"title":"AsyncTasks in MaterialAccount should not be instanciated at class initialization","user":{"login":"mlumeau","id":1519317,"avatar_url":"https://avatars.githubusercontent.com/u/1519317?v=3","gravatar_id":"","url":"https://api.github.com/users/mlumeau","html_url":"https://github.com/mlumeau","followers_url":"https://api.github.com/users/mlumeau/followers","following_url":"https://api.github.com/users/mlumeau/following{/other_user}","gists_url":"https://api.github.com/users/mlumeau/gists{/gist_id}","starred_url":"https://api.github.com/users/mlumeau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlumeau/subscriptions","organizations_url":"https://api.github.com/users/mlumeau/orgs","repos_url":"https://api.github.com/users/mlumeau/repos","events_url":"https://api.github.com/users/mlumeau/events{/privacy}","received_events_url":"https://api.github.com/users/mlumeau/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/neokree/MaterialNavigationDrawer/labels/testing","name":"testing","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-28T16:18:17Z","updated_at":"2015-02-05T15:00:33Z","closed_at":null,"body":"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.\r\n\r\nA workaround would be to define AsyncTask inner classes of MaterialAccount (ResizePhotoBitmapAsyncTask, ResizeBackgroundBitmapAsyncTask...) and define setPhotoBitmap, setBackgroundBitmap, etc... as the following: \r\n```java\r\npublic void setPhoto(Bitmap photo) {\r\n    new ResizePhotoBitmapAsyncTask().execute(photo);\r\n} `"},"comment":{"url":"https://api.github.com/repos/neokree/MaterialNavigationDrawer/issues/comments/73059804","html_url":"https://github.com/neokree/MaterialNavigationDrawer/issues/143#issuecomment-73059804","issue_url":"https://api.github.com/repos/neokree/MaterialNavigationDrawer/issues/143","id":73059804,"user":{"login":"mlumeau","id":1519317,"avatar_url":"https://avatars.githubusercontent.com/u/1519317?v=3","gravatar_id":"","url":"https://api.github.com/users/mlumeau","html_url":"https://github.com/mlumeau","followers_url":"https://api.github.com/users/mlumeau/followers","following_url":"https://api.github.com/users/mlumeau/following{/other_user}","gists_url":"https://api.github.com/users/mlumeau/gists{/gist_id}","starred_url":"https://api.github.com/users/mlumeau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlumeau/subscriptions","organizations_url":"https://api.github.com/users/mlumeau/orgs","repos_url":"https://api.github.com/users/mlumeau/repos","events_url":"https://api.github.com/users/mlumeau/events{/privacy}","received_events_url":"https://api.github.com/users/mlumeau/received_events","type":"User","site_admin":false},"created_at":"2015-02-05T15:00:33Z","updated_at":"2015-02-05T15:00:33Z","body":"That did it. Everything runs perfectly with your fix.\r\nThanks."}}