get All Packages - Android App

Android examples for App:Package

Description

get All Packages

Demo Code


//package com.java2s;
import android.content.Context;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import java.util.ArrayList;

import java.util.List;

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;
    }// w  w  w .jav a2s  .  c o m
}

Related Tutorials