How to Show App's Name in "Completing action using" menu?

646 views Asked by At

I tried to use implicit intent to open my android app. It almost works, my app icon really appears in the menu "completing action with". However, instead of showing the real app name, as all the other applications do, the name appeared below the icon of my app is the package name, like "com.example.xxx", which is not quite user friendly. Where can I define this name?

Here's the code I used in the manifest xml:

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.testImplicitIntent.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="http" />
            <data android:host="*" />
            <data android:pathPattern=".*\\.txt" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="http" />
            <data android:host="*" />
            <data android:mimeType="application/txt" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="file" />
            <data android:host="*" />
            <data android:pathPattern=".*\\.txt" />
        </intent-filter>
    </activity>
</application>
1

There are 1 answers

0
Subhash Hardaha On

There is some problem with your @string@/app_name

Inside the intent filter in each intent filter give the android label

<activity
        android:name="com.example.testImplicitIntent.MainActivity"
        android:label="@string/app_name" >
        <intent-filter android:label="@string/app_name" >
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter android:label="@string/app_name" >
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="http" />
            <data android:host="*" />
            <data android:pathPattern=".*\\.txt" />
        </intent-filter>
        <intent-filter android:label="@string/app_name" >
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="http" />
            <data android:host="*" />
            <data android:mimeType="application/txt" />
        </intent-filter android:label="@string/app_name" >>
        <intent-filter android:label="@string/app_name" >
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="file" />
            <data android:host="*" />
            <data android:pathPattern=".*\\.txt" />
        </intent-filter>
    </activity>