How to get Application name from package name in android?
You can get Application name from package using following code
final PackageManager pm = getApplicationContext().getPackageManager();
ApplicationInfo ai;
try {
ai = pm.getApplicationInfo( "your_package_name", 0);
} catch (final NameNotFoundException e) {
ai = null;
}
final String applicationName = (String) (ai != null ? pm.getApplicationLabel(ai) : "(unknown)");
android - Installed app section shows package name instead of app name for my own application
the application name (label) should be within the application
tag and not the activity
.
<application
android:label="@string/app_name"
>
....
How to get the name of the application in android?
you can use PackageManager#getApplicationInfo()
For getting the Application Name for all packages installed in the device.
Assuming you have your current Context object ctx
Resources appR = ctx.getResources();
CharSequence txt = appR.getText(appR.getIdentifier("app_name",
"string", ctx.getPackageName()));
Get app name from package name in android
You need to use PackageManager
to get detailed information about installed packages.
PackageManager packageManager = context.getPackageManager();
ApplicationInfo applicationInfo = null;
try {
applicationInfo = packageManager.getApplicationInfo(packageName, 0);
} catch (final NameNotFoundException e) {}
final String title = (String)((applicationInfo != null) ? packageManager.getApplicationLabel(applicationInfo) : "???");
Related Topics
Android - Running a Method Periodically Using Postdelayed() Call
Android Webview - Intercept Clicks
Proguard with Ormlite on Android
Android Bluetoothdevice.Getname() Return Null
How to Access a File from Asset/Raw Directory
Navigation Drawer with Backword Compatibility Android
Differencebetween System Apps and Privileged Apps on Android
Android Camera Android.Hardware.Camera Deprecated
Extending Relativelayout, and Overriding Dispatchdraw() to Create a Zoomable Viewgroup
Android Gridview Row Dividers/Separators
Using Onsaveinstancestate with Fragments in Backstack
Android Webview Click Open Within Webview Not a Default Browser
Continuous Speech Recognition Android
How to Programmatically Get the List of Registered Users in Firebase
Buttons Not Visible on the Application. What's Wrong
A Failure Occurred While Executing Org.Jetbrains.Kotlin.Gradle.Internal.Kaptexecution