Android examples for android.content.pm:PackageManager
get Application Name
import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.util.Log; import java.util.HashMap; public class Main{ public static String getApplicationName(Context context) { PackageManager packageManager = null; ApplicationInfo applicationInfo = null; try {// w w w . j a v a 2 s.co m packageManager = context.getPackageManager(); applicationInfo = packageManager.getApplicationInfo( context.getPackageName(), 0); } catch (PackageManager.NameNotFoundException e) { applicationInfo = null; } String applicationName = (String) packageManager .getApplicationLabel(applicationInfo); return applicationName; } }