当我接近 NFC 标签时,如何使列表消失?

how can i make disappear the list when i approached the NFC tag?

我的问题是,当我接近 NFC 标签时,立即出现一个列表,其中包含我为使用 NFC 而开发的所有应用程序,我不想要那个!! 我希望仅使用该特定 NFC 标签启动其中一个应用程序。

出现的列表是这样的:

而且我希望显示应用程序 "NFC UidClass",但不显示列表(我不会卸载其他 NFC 应用程序)。是这样的:

这是我的 AndroidManifest.xml:

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".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.nfc.action.NDEF_DISCOVERED" />

            <category android:name="android.intent.category.DEFAULT" />

            <data android:mimeType="text/plain" />
        </intent-filter>
    </activity>
</application>
<uses-permission android:name="android.permission.NFC" />
<uses-feature
    android:name="android.hardware.nfc"
    android:required="true" />

请有人帮助我。 :)

你必须使用 mime 类型。您可以添加具有特定 MIME 类型的 intent-filter ACTION_NDEF_DISCOVEREDhttps://developer.android.com/guide/topics/connectivity/nfc/nfc.html#mime

在你的AndroidManifest中:

<activity android:name=".MyActivity">
    <intent-filter>
        <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <data android:mimeType="application/vnd.com.mycompany.data"/>
    </intent-filter>
</activity>

例如,要创建具有特定 mime 类型的标签:

NdefRecord mimeRecord = NdefRecord.createMime("application/vnd.com.mycompany.data",
    "some data".getBytes(Charset.forName("US-ASCII")));