ok i understand the problem.here is the solution for ur problem
//crete a intent like this and add it in ur appliction
Intent intent = new Intent();
     intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
     intent.setAction(android.content.Intent.ACTION_VIEW);
String type = getMIMEType(f);
     intent.setDataAndType(Uri.fromFile(f), type);
 startActivity(intent);
//now create method to get mime type

private String getMIMEType(File f)
    {
     String end = f.getName().substring(f.getName().lastIndexOf(".")
+1, f.getName().length()).toLowerCase();
     String type = "";
     if(end.equals("mp3") || end.equals("aac") || end.equals("aac") ||
end.equals("amr") || end.equals("mpeg") || end.equals("mp4")) type =
"audio";
     else if(end.equals("jpg") || end.equals("gif") || end.equals
("png") || end.equals("jpeg")) type = "image";
 else if(end.equals("htm") || end.equals("html") ) type = "text";

     type += "/*";
     return type;
    }
//but it opens the html viewer not browser remember it.i think it is
enough to u.


On Aug 31, 4:22 pm, Nicolas Raoul <[email protected]> wrote:
> Hello all,
>
> Myopensource application needs to browse local HTML files on the SD
> card, and WebView is not enough because I need history and bookmarks.
>
> I wrote the following code. It correctly opens thebrowser, but fails
> to reach catalog.html and in fact it just opens whatever page was last
> browsed:
>
> Uri uri = Uri.parse("content://com.android.htmlfileprovider/sdcard/
> myapp/catalog.html");
> Intent intent = new Intent();
> intent.setData(uri);
> intent.setClassName("com.android.browser",
> "com.android.browser.BrowserActivity");
> startActivity(intent);
>
> Any idea why it does notopencatalog.html ?
> Thank you very much!
>
> Nicolas Raoulhttp://nicolas-raoul.blogspot.com
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to