Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.util.Log; public class Main { public static String getAppName(Context context) { String appName = ""; try { // ---get the package info--- PackageManager pm = context.getPackageManager(); PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0); appName = pm.getApplicationLabel(pi.applicationInfo).toString(); if (appName == null || appName.length() <= 0) { return ""; } } catch (Exception e) { Log.e("VersionInfo", "Exception", e); } return appName; } }