get Apk File Intent - Android Intent

Android examples for Intent:Open File

Description

get Apk File Intent

Demo Code


//package com.java2s;

import android.content.Intent;

import android.net.Uri;
import java.io.File;

public class Main {

    public static Intent getApkFileIntent(String param) {

        Intent intent = new Intent();
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setAction(Intent.ACTION_VIEW);
        Uri uri = Uri.fromFile(new File(param));
        intent.setDataAndType(uri,/*from ww  w  .  jav a 2  s .co m*/
                "application/vnd.android.package-archive");
        return intent;
    }
}

Related Tutorials