Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 806425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:14:27+00:00 2026-05-15T00:14:27+00:00

In Android’s settings, in the Manage Applications activity when clicking on an app, the

  • 0

In Android’s settings, in the “Manage Applications” activity when clicking on an app, the data is broken down into Application, Data, and cache. There is also a button to clear the cache. My app caches audio files and I would like the user to be able to clear the cache using this button. How do I store them so they get lumped in with the cache and the user can clear them? I’ve tried storing files using both of the following techniques:

newFile = File.createTempFile("mcb", ".mp3", context.getCacheDir());


newFile = new File(context.getCacheDir(), "mcb.mp3");
newFile.createNewFile();

In both cases, these files are listed as Data and not Cache.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T00:14:27+00:00Added an answer on May 15, 2026 at 12:14 am

    I can’t reproduce your problem, perhaps something else is wrong.

    Using the following application, I was able to create a file in the cache directory and then clear it using the Manage Applications function under Settings. I didn’t have to change anything in the manifest and from what I can tell, you really shouldn’t mess with the android:allowClearUserData option.

    public class CreateCacheFile extends Activity {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            Button button = (Button) findViewById(R.id.CreateFileButton);
            button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    File file = new File(
                            CreateCacheFile.this.getCacheDir(), "temp.txt");
    
                    try {
                        file.createNewFile();
                        FileWriter fw = new FileWriter(file);
                        BufferedWriter bw = new BufferedWriter(fw);
                        bw.write("Hello World");
                        bw.newLine();
                        bw.close();
    
                    } catch (IOException e) {
                        Toast.makeText(
                                CreateCacheFile.this, 
                                "Error!", 
                                Toast.LENGTH_SHORT).show();
                    }
                }
            });
        }
    }
    

    After running the application (and clicking the button to create the file):

    $ adb -d shell
    # ls /data/data/com.example.CreateCacheFile/cache
    temp.txt
    # cat /data/data/com.example.CreateCacheFile/cache/temp.txt
    Hello World
    # 
    

    Manage Applications reports that 4KB of space is in use for Cache. After clicking the button to clear it:

    # ls /data/data/com.example.CreateCacheFile/cache
    # cat /data/data/com.example.CreateCacheFile/cache/temp.txt
    temp.txt: No such file or directory
    # 
    

    At this point Manage Applications reports that 0KB of space is in use for Cache.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Android tells me that The application has stopped unexcepetedly, but there are no error's
Android provides some ways to save application information. http://developer.android.com/guide/topics/data/data-storage.html Now, my issue is that
Android passing multiple data to notification when i click on notification its only open
Android is based on Linux; can native Linux applications be run on Android?
Android application should show Events happening in city as per day/month/year anywhere in the
Android applications can specify intent-priority. How does android handle security situation such as following.
Android Market app purchases have a 15-min grace period when a customer can cancel
Android doesn't appear to provide a way for a user application to change the
Android's messaging app, located in projects/platform/packages/apps/Mms.git has a class called RecipientsEditor. I would like
Android: I am using following code to insert image into album According to description

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.