use the following url Environment.getExternalStorageDirectory()+"/
stocks.html"
you can also check if the following file exsists
File f=new File(ur);
System.out.println("file exsists"+f.exsists());//this line will print
true if file exsists otherwise false
On Dec 11, 12:12 pm, Stephan Wiesner <[email protected]>
wrote:
> Hi,
> I need to open a html file that sits on my sdcard in my default
> browser.
>
> The code works fine if the file is on the net or in my asset folder,
> but if I want to open it from the sdcard I get an
> 12-11 08:06:34.650: E/AndroidRuntime(6829):
> android.content.ActivityNotFoundException: No Activity found to handle
> Intent { act=android.intent.action.VIEW
> cat=[android.intent.category.BROWSABLE] dat=content:///mnt/sdcard/
> download/stocks.html?text/html }
>
> // String url =
> "file:///android_asset/stocks.html";
> // String url = "file:///mnt/sdcard/
> download/stocks.html";
> String url =
> "content:///mnt/sdcard/download/stocks.html?text/
> html";
> //File sdCard =
> Environment.getExternalStorageDirectory();
> //File dir = new
> File(sdCard.getAbsolutePath() + "/download/
> stocks.html");
>
> Intent i = new Intent(Intent.ACTION_VIEW);
>
> i.addCategory("android.intent.category.BROWSABLE");
> i.setData(Uri.parse(url));
> startActivity(i);
>
> Anything else I need to set on the Intent to make it realize that I
> want to open a browser?
> Thanks,
> Stephan
--
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en