Nullpointerexception In Cookiesyncmanager.createinstance In Asynctask
I have a class that extends from AysncTask. Inside the doInBackground method I want to update the cookies, so I have: CookieSyncManager.createInstance(context); // <<<
Solution 1:
I call it in Application
's onCreate()
passing the application as context
Solution 2:
I've never used CookieSyncManager
, but from what I can see in the docs may be you should not use it within a Thread because its already creating one:
A separate thread saves the cookies between, driven by a timer.
- You should call
createInstance
when the application starts, usually inonCreate()
getInstance().startSync()
InActivity.onResume()
- And
getInstance().stopSync()
inActivity.onPause()
Here you have an example
Hope this help.
Post a Comment for "Nullpointerexception In Cookiesyncmanager.createinstance In Asynctask"