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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:41:13+00:00 2026-06-13T04:41:13+00:00

I am working on a small program on Android to write some hard-coded text

  • 0

I am working on a small program on Android to write some hard-coded text to a file with a hard-coded name. While the operation is successful (there are no errors), I am not able to find the file on the emulator. My questions:

  1. Where are the files written?
  2. What is the file path I need for files to be stored on the home screen or the applications page (in general, a place where the UI can get to)?

The code:

public class MainActivity extends Activity {

    Button writeFile;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    writeFile = (Button) findViewById(R.id.writeFile);
    writeFile.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub

                //Step 1. Get file name.
                String file = "hello_files.txt";
                String str = "hello world";

                Log.v(this.toString(), "Going to write to a file.");
                FileOutputStream fos;
                try {
                    fos = openFileOutput(file, MODE_WORLD_READABLE | MODE_WORLD_WRITEABLE);
                    fos.write(str.getBytes());
                    Log.v(this.toString(), "Local path = ");
                    fos.close();
                } catch (FileNotFoundException e) {
                    // TODO Auto-generated catch block
                    Log.v(this.toString(), "File not found!!");
                    e.printStackTrace();
                } catch (IOException e) {
                    Log.v(this.toString(), "IO Exception.");
                    e.printStackTrace();
                }
            }
        });
}
  • 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-13T04:41:14+00:00Added an answer on June 13, 2026 at 4:41 am

    Files are stored in “/mnt/sdcard/” (External storage) or “/data/data/Your Package Name/” (Internal storage) (as in this question). You can access this folder from this package only (unless the phone is rooted).

    The second part of your question is not very clear. From what I can understand, Android is not like Windows (no desktop folder). To create a shortcut on the desktop, you need to implement an App widget.

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

Sidebar

Related Questions

is there any small working program for recieving from and sending data to client
I am writing a small program to send file between Android and PC through
I am currently working on a small program that should comment out some code
I am working on a small basic GUI program that gets the files from
I'm working on a small uni project where I have a program for a
I'm am currently working on a program in java which requires adding a small
I am working on small python payroll project where you enter employee name, wage,
What I would like to do is write a small program that continuously live
I am working on a small program that requires the user to insert a
I am working out a small program where I provide the command line arguments

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.