get Application Info - Android App

Android examples for App:App Information

Description

get Application Info

Demo Code


//package com.java2s;

import android.content.Context;

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

public class Main {

    public static PackageInfo getApplicationInfo(Context context,
            String packageName) {
        PackageManager mgr = context.getPackageManager();
        try {/*w w  w.j  a  v  a2s. c o  m*/
            return mgr.getPackageInfo(packageName, 0);
        } catch (NameNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related Tutorials