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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:33:27+00:00 2026-06-10T09:33:27+00:00

I am new in android development, and I’m trying to create a simple application

  • 0

I am new in android development, and I’m trying to create a simple application which reads some data from a text file and displays it in a ListView. The problem is my reader doesn’t find my file. I’ve debugged my application and that is the conclusion I’ve come up with. So, where does the text file have to placed in order for the reader to find it?
Heres some code:

     try
    {
          FileInputStream fstream = new FileInputStream("movies.txt");
          DataInputStream in = new DataInputStream(fstream);
          BufferedReader br = new BufferedReader(new InputStreamReader(in));

          String strLine;

          while ((strLine = br.readLine()) != null)
          {
              filme.add(strLine);
              Log.d(LOG_TAG,"movie name:" + strLine);
          }
          in.close();
    }
    catch (Exception e)
    {
                System.err.println("Error: " + e.getMessage());
    }

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-06-10T09:33:29+00:00Added an answer on June 10, 2026 at 9:33 am

    Put the file named movies.txt in res/raw, then use the following code

    String displayText = "";
    try {
    InputStream fileStream = getResources().openRawResource(
                        R.raw.movies);
    int fileLen = fileStream.available();
    // Read the entire resource into a local byte buffer.
    byte[] fileBuffer = new byte[fileLen];
    fileStream.read(fileBuffer);
    fileStream.close();
    displayText = new String(fileBuffer);
    } catch (IOException e) {
      // exception handling
    }
    
    • 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 development. I am creating an android application, in which
I am new to android development. Currently i am working on an application which
I'm new to android development, and im trying to create an app that is
I am new to android development . I'm trying to download and run the
I'm new to Android development. My OS is WinXP. I'm trying to install two
I'm quite new to Android development. My understanding is that you can create several
I am new to android development. I have created a popup window which is
I'm new to Android development and I'm currently going through some tutorials. When I
I am new to Android development and running into a bizarre issue for which
I am new to Android development and i have been asked to create an

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.