get All Packages within Context - Android android.content

Android examples for android.content:Context

Description

get All Packages within Context

Demo Code

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*/

}

Related Tutorials