寻找「;名称“;您的Android应用程序的

寻找「;名称“;您的Android应用程序的,android,Android,有没有办法(通过编程)找到你的应用程序的名称?我专门讨论清单文件中应用程序标记的android:label属性: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.test" android:versionCode="1" android:versionName="1.0"

有没有办法(通过编程)找到你的应用程序的名称?我专门讨论清单文件中应用程序标记的
android:label
属性:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.test" android:versionCode="1" android:versionName="1.0">
    <application android:label="THIS THING HERE!" android:icon="@drawable/icon">
        <!-- ... -->
    </application>
</manifest> 

我找到了一种方法。。。但似乎有点迟钝:

getPackageManager().getApplicationLabel(getApplicationInfo())

我找到了一个方法。。。但似乎有点迟钝:

getPackageManager().getApplicationLabel(getApplicationInfo())

如果android:label设置为使用字符串资源,例如:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.test" android:versionCode="1" android:versionName="1.0">
    <application android:label="@string/app_name" android:icon="@drawable/icon">
        <!-- ... -->
    </application>
</manifest> 

如果android:label设置为使用字符串资源,例如:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.test" android:versionCode="1" android:versionName="1.0">
    <application android:label="@string/app_name" android:icon="@drawable/icon">
        <!-- ... -->
    </application>
</manifest> 

android:label是否设置为资源标识符?还是像您的示例中那样是一个静态字符串?android:label是否设置为资源标识符?或者它是一个静态字符串,如您的示例中所示?