Only one line of output with DataInputStream.readLine() in android

by Michael » Mon, 13 Apr 2009 12:08:27 GMT

Sponsored Links
 Hi group,

I use the following code in a java-program on my desktop with sun-
jdk- to read a html file on my webserver. I get several lines
of output as expected. But when I use it in an android-app, the whole
html file is read in only one line.

Where could be the difference between the desktop and android
implementation? Do I have to change something like the encoding or
linebreak character?

URL url = new URL(" http://mysite.intern/test.html" ;);
DataInputStream dis = new DataInputStream(new BufferedInputStream
        while ((s = dis.readLine()) != null){



Other Threads

1. Clarification on loading local images with WebView

As I wrote in my previous reply:

Try creating a ContentProvider to serve the image, and see if you have
better luck with a content:// URL.

Not if your image is only in an asset. The image viewer won't have
rights to access it.

Not directly, but you can use the 2D graphics API (e.g., Canvas and
friends). Basically, you're looking to use the same techniques games do
to view a portion of a large map, for example.

Mark Murphy (a Commons Guy) | |

Android Online Training: 21-25 June 2010:


2. Clarification on loading local images with WebView

Hello all,
I apologize if this is beating a dead horse, but I have been through
the documentation and groups discussions over and over, and can't seem
to resolve this issue....

What I want to do:
- I am loading a remote web page into WebView using loadUrl() -
example:  webView.loadUrl("");
- That page has a very large image in it whose quality I do not want
degraded by the OS. So I am putting it in the assets directory of the
- The page.html that gets downloaded from my server, then has a
regular img tag in it like so:
<img src="file:///android_asset/largeimage.png"/>

I know there were some issues with reading assets from the file system
with different versions of the platform. But its not clear what
versions this affects and how to address the problem for all versions.
Can someone please clarify:

A) should what I am doing above work (because its not)

B) If it only works on some versions of the platform - which versions?
How should this be addressed when I can't guarantee what version of
the platform users are running?

I am targeting version 1.6 in my app because I thought that would be a
"safe" version to target. I am testing against version 2.0.1



3. broken pipe over ssl

4. Internet data request done via ContentProvider?

5. About layout

6. how to test touchscreen drive

7. Animating Views with custom layout