get Apk File Intent - Android App

Android examples for App:APK Information

Description

get Apk File Intent

Demo Code


//package com.java2s;

import java.io.File;

import android.content.Intent;
import android.net.Uri;

public class Main {
    public static Intent getApkFileIntent(File file) {
        Intent intent = new Intent();
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setAction(android.content.Intent.ACTION_VIEW);
        intent.setDataAndType(Uri.fromFile(file),
                "application/vnd.android.package-archive");
        return intent;
    }//from w ww.  j  a v a  2  s.  c  om
}

Related Tutorials