Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.pm.PackageManager; public class Main { public static String getPackageNameByUid(Context context, int uid) { PackageManager pm = context.getPackageManager(); String[] packageName = pm.getPackagesForUid(uid); if (packageName != null && packageName.length == 1) { return packageName[0]; } return "Null"; } }