There are several examples of content providers for different purposes around.
Here is one I found useful. http://blog.tourizo.com/2009/02/how-to-display-local-file-in-android.html Mark Murphy's book examples is also good for learning ContentProviders. Cheers, Wes On Apr 15, 6:23 am, Ajeet Singh <ajeet.invinci...@gmail.com> wrote: > Hi Wes > > I tried giving full path of CSS. But that did not work at all. Any > clue? > What else I can try ?? > > thanks, > Ajeet > On Apr 15, 2:03 am, wescorp <wesc...@gmail.com> wrote: > > > Hello, > > > I'm pretty sure, in the end, that your going to want to use a > > ContentProvider to load html, css, javascript, etc, into your webView. > > >http://developer.android.com/reference/android/content/ContentProvide... > > > Cheers, > > Wes > > > On Apr 14, 11:19 am, Mike Kedl <mike.k...@gmail.com> 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 <ajeet.invinci...@gmail.com> > > > 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 android-discuss@googlegroups.com To unsubscribe from this group, send email to android-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-discuss?hl=en -~----------~----~----~----~------~----~------~--~---