Saturday, February 4, 2012

Re: [android-developers] Problem loading HTML file from android_asset in Browser

You have two problems.

First, you are using setClassName() with packages and classes that are
not your own.

Second, you are telling the opened activity to find a help.html file
in its own application assets. file:///android_asset/help.html will be
interpreted in the context of the app trying to use it.

I am not aware of a Uri syntax that will work to have files in one
app's assets be addressable by another app.

On Fri, Feb 3, 2012 at 9:45 PM, Julian Bunn <jjbunn@gmail.com> wrote:
> I am trying to launch the browser to show an HTML help file that is in
> the assets directory of my .apk.
>
> My code is:
>
>                        Uri uri = Uri.parse("file:///android_asset/help.html");
>                        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
>
> intent.setClassName("com.android.browser","com.android.browser.BrowserActivity");
>                        startActivity(intent);
>
> The browser starts up and displays the error message that it can't
> find the help.html file. I've run out of ideas as to what may be wrong
> - can anyone please point out where I'm doing this incorrectly?
>
> Thanks!
> Julian
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

Android Training in NYC: http://marakana.com/training/android/

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment