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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:00:21+00:00 2026-05-21T11:00:21+00:00

I am trying to get a simple Hello World txt file to be written

  • 0

I am trying to get a simple Hello World txt file to be written then read by my android application. When viewing the DDMS File Explorer it successfully creates the text file but i then get a FileNotFoundException when trying to read it.

try {

        final String TESTSTRING = new String("Hello World");

        FileOutputStream fOut = openFileOutput("test.txt", MODE_WORLD_READABLE);
        OutputStreamWriter osw = new OutputStreamWriter(fOut);

        osw.write(TESTSTRING);
        osw.flush();
        osw.close();

        FileInputStream fIn = new FileInputStream("test.txt");
        InputStreamReader isr = new InputStreamReader(fIn);

        char[] inputBuffer = new char[TESTSTRING.length()];

        isr.read(inputBuffer);

        String readString = new String(inputBuffer);

        boolean isTheSame = TESTSTRING.equals(readString);

        Log.i("File Reading Stuff", "success = " + isTheSame);

    } catch (IOException e) {
        e.printStackTrace();
    }

also the error is java.io FileNotFoundException: /test.txt (No such file or directory)

Any Help Thanks.

  • 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-21T11:00:22+00:00Added an answer on May 21, 2026 at 11:00 am

    I don’t know where openFileOutput saves its files, but wouldn’t you use it’s input equivalent openFileInput to read such a file?

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

Sidebar

Related Questions

This is what I get when trying to compile a simple hello world program
I've been trying to get a simple hello world web app running on Sinatra.
I'm trying to assemble a simple Hello world application with Masm32. It assembles fine
When building a simple hello-world-style project trying to embed v8 I get an error
I'm trying to get a Flask hello world application working on a Dreamhost shared
It's getting frustrating. I've been trying to get a simple hello world type program
i'm trying to develop a simple Hello World web service using Axis2 v1.5, Tomcat6
I am trying to run a simple hello world example in python that runs
Trying to run a simple Hello World C++ program on Eclipse (Galileo) CDT plugin
I'm trying to run a simple Hello World! program on a Fedora Linux system

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.