get Html File Intent - Android Intent

Android examples for Intent:Open File

Description

get Html File Intent

Demo Code


//package com.java2s;

import android.content.Intent;

import android.net.Uri;

public class Main {

    public static Intent getHtmlFileIntent(String param) {

        Uri uri = Uri.parse(param).buildUpon()
                .encodedAuthority("com.android.htmlfileprovider")
                .scheme("content").encodedPath(param).build();
        Intent intent = new Intent("android.intent.action.VIEW");
        intent.setDataAndType(uri, "text/html");
        return intent;
    }//from   w  w  w .ja  v  a  2 s  .  c  o m
}

Related Tutorials