Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;

import android.content.pm.ApplicationInfo;

import android.content.pm.PackageManager;

import java.util.Collections;
import java.util.List;

public class Main {

    public static List<ApplicationInfo> getInstalledApplicationInfoList(Context context) {
        List<ApplicationInfo> applicationInfoList = getPackageManager(context).getInstalledApplications(0);
        Collections.sort(applicationInfoList,
                new ApplicationInfo.DisplayNameComparator(context.getPackageManager()));
        return applicationInfoList;
    }

    public static PackageManager getPackageManager(Context context) {
        return context.getPackageManager();
    }
}