The problem I was experiencing here was actually to do with the viewpager I have on the main activity.
The problem I was experiencing here was actually to do with the viewpager I have on the main activity. As the AsyncTask was creating a cursor for the PagerAdapter I wasn't setting the adapter until it had finished. There is a known problem with ViewPagers and activity onPause when an adapter has not been set (see here).
To overcome this I modified my adapter to return 0 when there is no cursor available to the adapter: public int getCount() { // return the size of the cursor if it has been instantiated; return (mCursor! =null)? MCursor.getCount() : 0 ; } and added a setCurrentCursor method to the adapter.
This way I was able to set the adapter up and bind it to the viewpager in onCreate and then add the cursor to the adapter when it became available from the ASyncTask; public void setCurrentCursor(Cursor cu){ this. MCursor = cu; this. NotifyDataSetChanged(); } Now all I have to do is call adapter.
SetCurrentCursor in the onPostExecute method of the ASyncTask passing in the created cursor. Hope this helps. Thanks, m.
First try to cancel the asynctask and then start another activity may be that work for you.
I don't really want to cancel it. It's correct for it to continue running even if a different activity is started. – mAndroid Sep 27 at 7:41 if you want to running even if a different activity is started then use service and put your logic there if it is possible in your case.
– Vijay Sep 27 at 9:12 does you mean that it is not possible to have an AsyncTask running while the parent UI activity is paused? – mAndroid Sep 28 at 1:03.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.