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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:28:58+00:00 2026-06-05T08:28:58+00:00

I have a feeling that the path to the assets file is wrong but

  • 0

I have a feeling that the path to the assets file is wrong but i am not sure of the right path to use. I had double checked the text file are actually located in the assets What makes me think its the wrong file or directory is because of the error no such file or directory?

There is conditional code wrapped around the Question code which is used to store the different fields. The code specifies if there is equal to four elements in the array then populates the array list with data from the file. If this condition is not made then a log will show an error. The file are named

  • quiz1.txt
  • quiz2.txt
  • quiz3.txt

Here is the LogCat

 06-11 11:29:02.526: I/global(317): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
 06-11 11:29:02.526: E/path of text file(317): What is the output of: 
 06-11 11:29:02.526: E/path of text file(317): echo 6 % 4;<.>
 06-11 11:29:02.526: E/path of text file(317): 2<.>
 06-11 11:29:02.526: E/path of text file(317): 4<.>
 06-11 11:29:02.526: E/path of text file(317): 2<.>
 06-11 11:29:02.526: E/path of text file(317): 0<.>
 06-11 11:29:02.526: W/System.err(317): Error: read() /What is the output of: 
 06-11 11:29:02.526: W/System.err(317): echo 6 % 4;<.>
 06-11 11:29:02.526: W/System.err(317): 2<.>
 06-11 11:29:02.526: W/System.err(317): 4<.>
 06-11 11:29:02.526: W/System.err(317): 2<.>
 06-11 11:29:02.536: W/System.err(317): 0<.>
 06-11 11:29:02.536: W/System.err(317):  (No such file or directory)
 06-11 11:29:02.536: E/YourApp(317): 1
 06-11 11:29:02.536: E/YourApp(317): Data was not split from file correctly
 06-11 11:29:02.536: I/global(317): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
 06-11 11:29:02.536: E/path of text file(317): Which of following is NOT a valid comment in PHP<.>
 06-11 11:29:02.536: E/path of text file(317): 3<.>
 06-11 11:29:02.536: E/path of text file(317): // comment<.>
 06-11 11:29:02.536: E/path of text file(317): # comment<.>
 06-11 11:29:02.536: E/path of text file(317): <!-- comment --><.>
 06-11 11:29:02.536: W/System.err(317): Error: read() /Which of following is NOT a valid comment in PHP<.>
 06-11 11:29:02.536: W/System.err(317): 3<.>
 06-11 11:29:02.536: W/System.err(317): / comment<.>
 06-11 11:29:02.536: W/System.err(317): # comment<.>
 06-11 11:29:02.536: W/System.err(317): <!-- comment --><.>
 06-11 11:29:02.536: W/System.err(317):  (No such file or directory)
 06-11 11:29:02.536: E/YourApp(317): 1
 06-11 11:29:02.536: E/YourApp(317): Data was not split from file correctly
 06-11 11:29:02.546: I/global(317): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
 06-11 11:29:02.546: E/path of text file(317): Which of following is a valid function definition in PHP<.>
 06-11 11:29:02.546: E/path of text file(317): 3<.>
 06-11 11:29:02.546: E/path of text file(317): int f()<.>
 06-11 11:29:02.546: E/path of text file(317): private int f()<.>
 06-11 11:29:02.546: E/path of text file(317): function f()<.>
 06-11 11:29:02.546: W/System.err(317): Error: read() /Which of following is a valid function definition in PHP<.>
 06-11 11:29:02.546: W/System.err(317): 3<.>
 06-11 11:29:02.546: W/System.err(317): int f()<.>
 06-11 11:29:02.546: W/System.err(317): private int f()<.>
 06-11 11:29:02.546: W/System.err(317): function f()<.>
 06-11 11:29:02.546: W/System.err(317):  (No such file or directory)
 06-11 11:29:02.546: E/YourApp(317): 1
 06-11 11:29:02.546: E/YourApp(317): Data was not split from file correctly

Below is Source Code

class Question
{
    String question;
    int answer;
    String choice1;
    String choice2;
    String choice3;

}

public class Uploader extends Activity
{
    private static final String LOGS = null;
    Question q;
    String textfile;
    InputStream is;

    public void onCreate(Bundle b)
    {
        super.onCreate(b);
        setContentView(R.layout.basic);

        ArrayList<Question> list = new ArrayList<Question>();

        for (int i = 1; i <= 3; i++)
        {

            try {
            AssetManager assetManager = getAssets();
            // is =  getResources().getAssets().open("quiz"+i+".txt");
          //
        String quizes[] = assetManager.list("myquizfolder");
        for(String quiz : quizes) {
            InputStream in = assetManager.open("myquizfolder/" + quiz);
         textfile = convertStreamToString(in);
        }

                 catch (IOException e)
            {
                // TODO Auto-generated catch block
                Log.e("path of text file", textfile);
                e.printStackTrace();
            }

            ResultsReader reader = new ResultsReader(textfile);
            reader.read();

            String str = ((ResultsReader) reader).getInput();
            String data[] = str.split("<.>");

            String datainfo = Integer.toString(data.length);
            Log.e("YourApp", datainfo);
            Question q = new Question();
            if (data.length == 4)
            {
                q.question = data[0];

                q.answer = Integer.parseInt(data[1]);

                q.choice1 = data[2];
                q.choice2 = data[3];
                q.choice3 = data[4];
            } else
            {
                Log.e("YourApp", "Data was not split from file correctly");
            }
            list.add(q);

        }
    }
}





 public static String convertStreamToString(InputStream is)
            throws IOException {
            Writer writer = new StringWriter();

            char[] buffer = new char[2048];
            try {
                Reader reader = new BufferedReader(new InputStreamReader(is,
                        "UTF-8"));
                int n;
                while ((n = reader.read(buffer)) != -1) {
                    writer.write(buffer, 0, n);
                }
            } finally {
                is.close();
            }
            String text = writer.toString();
            return text;

    }
  • 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-05T08:28:59+00:00Added an answer on June 5, 2026 at 8:28 am

    if you you use this you’ll be ensure that paths are correct.

    AssetManager assetManager = getAssets();
    String quizes[] = assetManager.list("myquizfolder");
    for(String quiz : quizes) {
        InputStrem in = assetManager.open("myquizfolder/" + quiz);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm aware of IDENTITY fields but I have a feeling that I couldn't use
${requestScope['javax.servlet.forward.servlet_path']} gets me the right string, but not including parameters that might be set
I have the feeling that using Sitemap in ASP.NET is not conducive to CSS.
I have a feeling that I already know the answer to this one, but
I have a feeling that there must be client-server synchronization patterns out there. But
I have a feeling that this query is pretty easy to construct, I just
I have a feeling that I am going to ask a stupid question, yet
I somehow have the feeling that modern systems, including runtime libraries, this exception handler
This is an SDL problem, however I have the strong feeling that the problem
I have a large file that needs to be processed before feeding to another

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.