0

在进行解析查询和缓存图像之后,我正在获取和显示图像。我的问题是,当我单击清除缓存时,它不会删除图像,而我的页面查看器则用于显示它们。它显示重复项。我正在使用来自http://developer.android的 Caching Bitmaps 的Image Fetcher https://developer.android.com/samples/DisplayingBitmaps/src/com.example.android.displayingbitmaps/util/ImageFetcher.html .com/training/displaying-bitmaps/cache-bitmap.html将文件保存到手机内存

私有 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);
}
4

0 回答 0