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

  • SEARCH
  • Home
  • 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 9000341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:17:58+00:00 2026-06-16T00:17:58+00:00

I am new to Android programming and so kingly pardon me if this question

  • 0

I am new to Android programming and so kingly pardon me if this question sounds stupid. I want to read and write from a file in an Android Program. I am aware of how to do that in Java.

Having read the documentation I wrote the following code. However I am unable to locate where this file is. According to the documentation it should be in folder data/data/package_name.

I have Samsung Galaxy S2. I launched the application, then closed it. When I went looking for the file I could not find it. I looked in My Files/data. But there is no data folder inside this data folder. What am I doing wrong?

Thank you for the help.

Sources:
1. http://developer.android.com/training/basics/data-storage/files.html
2. http://www.vogella.com/articles/AndroidFileBasedPersistence/article.html#overview

public class MainActivity extends Activity {

private void writeFileToInternalStorage() {
      String eol = System.getProperty("line.separator");
      BufferedWriter writer = null;
      try {
        writer = new BufferedWriter(new OutputStreamWriter(openFileOutput("myfile.txt", MODE_WORLD_WRITEABLE)));
        writer.write("This is a test1." + eol);
        writer.write("This is a test2." + eol);
      } catch (Exception e) {
          e.printStackTrace();
      } finally {
        if (writer != null) {
        try {
          writer.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
        }
      }
}   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    writeFileToInternalStorage();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}

}
  • 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-06-16T00:17:59+00:00Added an answer on June 16, 2026 at 12:17 am

    Unless and until your phone is rooted or you are using an emulator, I don’t think you will able to see private files. Anyways, on the emulator you can always do an “adb shell” and do a “cd /data/data/package_name/” to have a look at the files.

    One deprecated option is to set the flags as MODE_WORLD_READABLE or MODE_WORLD_WRITEABLE in the mode section of the openFileOutput(String name, int mode) function.

    Else if you want to access it through your file manager, you always have the option of storing non-private data on your phone’s external storage. Have a look at the Save a File on External Storage section to know how to do that.

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

Sidebar

Related Questions

I am new to Android programming and so kingly pardon me if this question
I'm fairly new to Android programming, so this may be a simple question, but
i'm pretty new to android programming and i'm try to read an xml file.
I'm new to android programming, what I want to do is get location from
I am new to android programming and so please pardon if the question looks
I am new to android programming and i am trying to develop this app
i am new to android programming and i want to create an api with
Hi I am completely new to Android programming and the question I am asking
I'm new to Android programming and could really use some help with a program
i am new to android programming.i looking to make a question and answer application.in

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.