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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:02:38+00:00 2026-06-02T01:02:38+00:00

I try to read a text file on a server. But i don’t have

  • 0

I try to read a text file on a server. But i don’t have the test returned. Seems I have a Exception error.

How to see the error in eclipse, or displaying the error ?

If I try to log the erreor, the app go closed. (Log.e(“Exception —>”,e.getMessage());)

The code here after doent work.

public static String getText(String urlAdress) {
    String text_file = "";
    BufferedReader in = null;
    try {
        // create a url object
        URL url = new URL(urlAdress);

        // create a urlconnection object
        URLConnection urlConnection = url.openConnection();

        // Read all the text returned by the server
        in = new BufferedReader(new InputStreamReader(
                urlConnection.getInputStream()));
        String str;
        while ((str = in.readLine()) != null) {
            // str is one line of text; readLine() strips the newline
            // character(s)
            text_file = text_file + str;
        }
        in.close();
    } catch (MalformedURLException e) {
        text_file = "error";
        Log.e("MalformedURLException --->", e.getMessage());
    } catch (IOException e) {
        text_file = "error";
        Log.e("IOException --->", e.getMessage());
    } catch (Exception e) {
        text_file = "error";
        // Log.e("Exception --->",e.getMessage());
        e.printStackTrace();
    } finally {
        if (in != null) {
            try {
                in.close();
            } catch (IOException e) {
                Log.e("finally IOException --->",
                        "Exception trying to close BufferedReader");
            }
        }

    }

    return text_file;
}

Any Idea ?

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-02T01:02:39+00:00Added an answer on June 2, 2026 at 1:02 am

    So, take a look at this. This means you need to move all that code from main thread to another thread.

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

Sidebar

Related Questions

I try to read a local file from server. I have been googling this
Hi I have been using the Buffered Reader to try to read a text
try to write a composite component that allows mutltiple text inputs. I read that
I read Japanese, and want to try processing some Japanese text. I tried this
I try to read file /proc/'pid'/status, using c program. The code is as follows,
I see that when I try to read the value from a textarea field
I request a text file from a server. The url does not end in
I am trying to read in a text file from an SQL query (SQL
Problem I have a file which contains such text (nothing else) 2010-10-05 I would
I'm trying to write to a text file on my web server using HttpURLConnection.getOutputStream().

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.