How to perfom an image clear_cache in android

67 views Asked by At

I am getting and displaying images after doing Parse Queries and caching images. My problem is that when i click on the clear cache it doesn't delete the images and my pageviewer with i use to display them. It displays duplicates.I'm using Image Fetcher https://developer.android.com/samples/DisplayingBitmaps/src/com.example.android.displayingbitmaps/util/ImageFetcher.html from Caching Bitmaps from http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html saving files to the phone memory

private ImageFetcher mImageFetcher; ...

public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        NavUtils.navigateUpFromSameTask(this);
        return true;
    case R.id.logout:
        ParseUser.logOut();
        Intent intent = new Intent(this, LoginActivity.class);
        startActivity(intent);
        finish(); // logout code
        return true;

    case R.id.prefs:
        Intent i = new Intent(this, SharedPrefsActivity.class);
        startActivityForResult(i, RESULT_SETTINGS);

        // intent = new Intent(this, SharedPrefsActivity.class);
        // startActivity(intent);
        // finish(); //logout code
        return true;
    case R.id.clear_cache:
        mImageFetcher.clearCache();
        Toast.makeText(this, R.string.clear_cache_complete_toast,
                Toast.LENGTH_SHORT).show();
        return true;
    }
    return super.onOptionsItemSelected(item);
}
0

There are 0 answers