Android examples for android.content:Context
get All Packages within Context
import java.util.ArrayList; import java.util.List; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; public class Main { public static List<PackageInfo> getAllPackages(Context context) { List<PackageInfo> packageList = new ArrayList<PackageInfo>(); PackageManager pm = context.getPackageManager(); packageList = pm.getInstalledPackages(0); return packageList; }/* ww w . ja v a2 s .c o m*/ }