I did import the app, and I was testing it.


I put a breakpoint in onDestroy, and it never got hit.


I'm not sure how to force the onDestroy() still.


Thanks.



On Friday, April 19, 2013 2:20:10 PM UTC-5, tsioularisa wrote:
>
> I changed in the imageworker class these methods
>
> public void clearCache() {
>         new CacheAsyncTask().execute(MESSAGE_CLEAR);
>     }
>
>     public void flushCache() {
>         new CacheAsyncTask().execute(MESSAGE_FLUSH);
>     }
>
>     public void closeCache() {
>         new CacheAsyncTask().execute(MESSAGE_CLOSE);
>     }
>
> to these
>
> public void clearCache() {
>         clearCacheInternal();
>     }
>
>     public void flushCache() {
>         flushCacheInternal();
>     }
>
>     public void closeCache() {
>        closeCacheInternal();
>     }
>
> in order to test your code. I think is the same with what you sent me. 
>
> As for the onDestroy you can check if it is being called with a 
> log.d(TAG,"onDestroy called); in the onDestroy and you can then check it in 
> the logcat while you are testing the app. You can also call the clearcache 
> to be more sure that it will always be called with the override of the 
> onBackPressed. Inside this you can call the clearcache. Another solution is 
> to chec isfinishing in the onPause method. If it is true you can call the 
> clearcache.
>
> In order to implement the last two clearcache cases you have to call them 
> inside the imageGridActivity. In order to do this implement these methods 
> in this activity
>
> private String gridFragmentTag;
>
> public void setGridFragmentTag(String tag){
> gridFragmentTag = tag;
> }
>  public String getGridFragmentTag(){
> return gridFragmentTag;
> }
>
> @Override
> protected void onPause() {
> super.onPause();
> Log.i(TAG, "On Pause executed");
>  if (isFinishing()) {
> Log.i(TAG, "isFinishing executed");
> if(getGridFragmentTag() != null)
>
> ((ImageGridFragment)getSupportFragmentManager().findFragmentByTag(getGridFragmentTag())).clearCachesWhenExit();
>  }
>  }
>
> or
> //
> onBackPressed(){
>        if(getGridFragmentTag() != null)
>
> ((ImageGridFragment)getSupportFragmentManager().findFragmentByTag(getGridFragmentTag())).clearCachesWhenExit();
> }
>
> and set the fragment tag from the imageGridFragment like this in the 
> onCreatview
>
> ((ImageGridActivity)getActivity()).setGridFragmentTag(getTag());
>
> and implement this method in this fragment
>
> public void clearCachesWhenExit(){
> if(mImageFetcher != null){
> mImageFetcher.clearCache();
> }
> }
>
> By the way have you import the app and you are testing it? Have you 
> succeed to reproduce the problem?
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to