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 4601654
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:51:32+00:00 2026-05-21T23:51:32+00:00

For debugging purposes I need to access the shared preferences file of my application.

  • 0

For debugging purposes I need to access the shared preferences file of my application. As far as I know I should find this file in /data/… but I can’t access the /data folder through to missing permissions. Is this normal? Any way to still access the file? (except maybe raeding it from inside the application?) The phone is not rooted and I also don’t want to root it.
Thanks for any hint!

  • 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-21T23:51:33+00:00Added an answer on May 21, 2026 at 11:51 pm

    I have ran into this issue in the past (not having root permission on the file system but needing access to the applications data folder). If you don’t have a rooted device or a developer device such as the ADP1 then you can try running your application on the emulator and then accessing the files from the “File Explorer” in eclipse or DDMS.

    EDIT #1:
    Try using the getAll function of sharedPreferences and saving that to a file, I will see if I can throw together a sample.

    EDIT #2:
    Example Code, created from random samples around the net, probably not the best way to do it, but I tested it and it does work. It writes a file to the root of your sdcard. Make sure you have

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
    

    set in your manifest

    private void saveSharedPreferences()
    {
        // create some junk data to populate the shared preferences
        SharedPreferences prefs = getSharedPreferences("MyPrefs", MODE_PRIVATE);
        SharedPreferences.Editor prefEdit = prefs.edit();
        prefEdit.putBoolean("SomeBooleanValue_True", true);
        prefEdit.putInt("SomeIntValue_100", 100);
        prefEdit.putFloat("SomeFloatValue_1.11", 1.11f);
        prefEdit.putString("SomeStringValue_Unicorns", "Unicorns");
        prefEdit.commit();
    
        // BEGIN EXAMPLE
        File myPath = new File(Environment.getExternalStorageDirectory().toString());
        File myFile = new File(myPath, "MySharedPreferences");
    
        try
        {
            FileWriter fw = new FileWriter(myFile);
            PrintWriter pw = new PrintWriter(fw);
    
            Map<String,?> prefsMap = prefs.getAll();
    
            for(Map.Entry<String,?> entry : prefsMap.entrySet())
            {
                pw.println(entry.getKey() + ": " + entry.getValue().toString());            
            }
    
            pw.close();
            fw.close();
        }
        catch (Exception e)
        {
            // what a terrible failure...
            Log.wtf(getClass().getName(), e.toString());
        }
    }
    

    Sources One Two Three

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

Sidebar

Related Questions

I'm consuming a third party .NET WebService in my client application. For debugging purposes
For debugging purposes, I need to follow the execution of some piece of code,
I have to maintain an old asp.net application, and need to disable all access
For debugging purposes, I need to recursively search a directory for all files which
I have need to print indented template names for debugging purposes. For example, instead
I need to get the jruby version for logging & debugging purposes. I tried
For debugging purposes in a somewhat closed system, I have to output text to
Is it possible for the compiler to remove statements used for debugging purposes (such
When debugging an application in Visual Studio, there are 2 options for breaking on
For debugging purposes, when I'm writing an app, the first thing I do is

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.