I know there's a lot of questions on here about reading local HTML files, but I haven't found any that satisfy my needs.
I would like to have a DialogFragment pop up, show a message with a link in it, click that link and have a local HTML file read (preferably from the default web browser).
What I have so far:
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());
alertDialogBuilder.setMessage(Html.fromHtml("I have read and agree to the " + "<a href=\"file:///android_asset/privacy.html\">Terms and Conditions</a>" + " and the " + "<a href=\"http://www.samsung.com/global/business/mobile/info/privacy.html\">Privacy Policy</a>"));
alertDialogBuilder.setCancelable(false);
//rest of code...
}
The second link which points to the online version works like a charm. The first link should point to a local privacy.html file in my assets folder. When clicking on the first link, an error occurs:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=file:///android_asset/privacy.html (has extras) }
Anyone have any tips/advice for this situation? I've tried multiple different HTML files, all with the same result. Am I going to have to use my own WebView for something like this? Seems like there should be a way to ask Android to view a local HTML file from the default browser when clicking on a link...