install Apk - Android android.content.pm

Android examples for android.content.pm:Apk Install

Description

install Apk

Demo Code

import android.app.Activity;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.view.inputmethod.InputMethodManager;
import java.io.File;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main{

    public static void install_Apk(File file, Activity activity) {
        Intent intent = new Intent();
        intent.setAction("android.intent.action.VIEW");
        intent.addCategory("android.intent.category.DEFAULT");
        intent.setDataAndType(Uri.fromFile(file),
                "application/vnd.android.package-archive");
        activity.startActivity(intent);/*from w  ww. jav  a 2  s  . co  m*/
    }

}

Related Tutorials