Hi Mike,

thanks for your reply.
I already tried giving full path. But unfortunately this also does not
work at all.

Any help would be appreciated.

Thanks,
Ajeet Singh

On Apr 14, 10:19 pm, Mike Kedl <[email protected]> wrote:
> I'm just guessing since I haven't tried this myself, but wouldn't you
> need to specify the path more completely in the cs statement?
> Since you are reading the html in, the base is not really specified,
> try either /sdcard/test_files/ex.css or
> file:///sdcard/test_files/ex.css.
> (this is assuming you can read html from the filesystem at all)
>
> On Tue, Apr 14, 2009 at 4:43 AM, Ajeet Singh <[email protected]> 
> wrote:
>
> > Hi all,
>
> > Problem: css is not loaded of a HTML file [ i am using
> > loadDataWithBaseURL("file", new String(arry), "text/html", "utf-8", "
> > ") from class WebView ]
>
> > What I have done:
> > 1- Pushed test.HTML file into /sdcard
> > 2- Made test_files folder in /sdcard (it looks like /sdcard/
> > test_files)
> > 3- In folder /sdcard/test_files/ i pushed my css file (ex.css )
> > 4- I read the test.html file into byte array and passing to function
> > loadDataWithBaseURL() in string format.
>
> > Its proper behavour that html file should be loaded with css
> > properties.
> > But css doesn't executes at all :( in this case.
>
> > Can anybody help me regarding this?
> > Why the css file is not executing at all? Is there any other way where
> > I can load my html file with proper css applied on.
>
> > I am giving all my code below here?
>
> > -------------------------------------------------------------------------------------------------
> > -------------------------------------------------------------------------------------------------
> > test.html
> > -------------------------------------------------------------------------------------------------
> > <html>
> > <head>
> > <link rel="stylesheet" type="text/css" href="test_files/ex.css" />
> > </head>
> > <body>
>
> > <h1>This header is 36 pt</h1> <h2>This header is blue</h2> <p>This
> > paragraph has a left margin of 50 pixels</p>
>
> > </body>
> > </html>
> > --------------------------------------------------------------------------------------------------
> > ---------------------------------------------------------------------------------------------------
> > ex.css
> > -------------------------------------------------------------------------------------------------
> > body {background-color: yellow} h1 {font-size: 36pt} h2 {color: blue}
> > p {margin-left: 50px}
>
> > -------------------------------------------------------------------------------------------------
> > -------------------------------------------------------------------------------------------------
> > My java code
> > -------------------------------------------------------------------------------------------------
> > package com.android.LocalFileBrowsing;
>
> > import java.io.File;
> > import java.io.FileInputStream;
>
> > import android.app.Activity;
> > import android.os.Bundle;
> > import android.webkit.WebView;
>
> > public class LocalFileBrowsing extends Activity {
> >   �...@override
> >    public void onCreate(Bundle icicle) {
> >          super.onCreate(icicle);
> >          WebView webView = new WebView(this);
> >          setContentView(webView);
> >          File file = new File("/sdcard/Google.html");
> >          if (!file.exists())
> >                return;
> >          byte[] arry = new byte[(int) file.length()];
> >          try {
> >                FileInputStream fin = new FileInputStream(file);
> >                fin.read(arry);
> >                fin.close();
> >          } catch (Exception e) {
> >                e.printStackTrace();
> >          }
>
> >          webView.loadDataWithBaseURL("file", new String(arry), "text/
> > html", "utf-8", "Error: 404 ");
> >    }
> > }
>
> > Thanks in advance.
> > Ajeet
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Android Discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/android-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to