Webview of local webpage shows cluttered/repeated text

by jb » Tue, 10 Aug 2010 07:03:40 GMT


Sponsored Links
 Hi,

I display a local webpage (located in my 'assets' directory) within a
Webview. The webpage is almost exclusively text.
When displayed, the middle third of the body of text appears to be
repeated multiple times, and makes the text appear very cluttered.

I ran the webpage through the W3C html validator and it passed without
any errors.

Displaying it on regular browsers work perfectly.

Here's my code:

setContentView(R.layout.signpost);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.setBackgroundColor(0); // make the background transparent
mWebView.setBackgroundResource(R.drawable.background);
InputStreamReader is = null;
try {
        is = new
InputStreamReader(getApplicationContext().getAssets().open("signPostContent.html"));
        BufferedReader buff = new BufferedReader(is, 8192);
        StringBuffer out = new StringBuffer();
        String strLine = null;
        while ((strLine = buff.readLine()) != null) {
                out.append(strLine);
        }
        is.close();
        String mimeType = "text/html";
        String encoding = "utf-8";
        String fin = new String(out.toString());
        mWebView.loadDataWithBaseURL("file:///sdcard/data/data/
com.this.that/", fin, mimeType, encoding, "");
} catch (IOException e) {
        e.printStackTrace();
}

Any ideas?

jb

--



Webview of local webpage shows cluttered/repeated text

by Mark Murphy » Tue, 10 Aug 2010 07:20:21 GMT


 


Try using:

mWebView.loadUrl("file:///android_asset/signPostContent.html");

instead.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
Available!

--


Sponsored Links


Other Threads

1. LVL licensing and versioning question

Hello,

Using the licensing technique described here
http://developer.android.com/guide/publishing/licensing.html
I'm trying to test what happens when:
- I would upgrade my LVL protected app to a new version
- Some user hasn't upgraded yet
Will the user with the old version still be able to continue? Will the
licensing server return LICENSED_OLD_KEY as I expect it to, and thus
allow access?

The scenario I used to test this:
- uploaded to market a signed version 1.0.0 (did not publish it) of my
app which has never been published nor uploaded before
- setup test account and let the test response be LICENSED
- on Nexus1 tested and verified that when using the apk (so the one in
<project>/bin), LICENSED is returned.
- increased versionCode and versionName to 1.0.1, signed and uploaded
that version to market (didn't publish)
- on N1 installed the new apk (again the newly compiled one from
<project>/bin). LVL returns NOT_MARKET_MANAGED so indicating that it's
not available in the market. But I expected LICENSED_OLD_KEY to be
returned.

Am I trying something that's not possible to test? From other posts
like this one: 

2. HTC Hero

Hi everyone.
Does anyone know if there are differences between the G2 and Hero.
Software differences.
Will the app I wrote for G2 work the same way on a Hero?

Thanks.

-- 
Eros Eduardo Stein
Tcnico de Informtica / Em breve analista.
USE >> http://www.ekaaty.org
http://www.erosstein.info

--~--~---------~--~----~------------~-------~--~----~

3. Tablet programming

4. WebServis authentication problem, Android

5. Ethernet auto detection

6. Launching application in Market

7. Fwd: : V4l2 Camera Integration