Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;
import android.content.Intent;

import android.net.Uri;
import android.text.TextUtils;

public class Main {

    public static void uninstallApk(Context context, String packageName) {
        if (context == null)
            return;
        if (TextUtils.isEmpty(packageName))
            return;
        Intent intent = new Intent(Intent.ACTION_DELETE);
        Uri packageURI = Uri.parse("package:" + packageName);
        intent.setData(packageURI);
        context.startActivity(intent);
    }
}