我想在android上写我的第一个NFC应用程序。为此,我使用了安卓开发者链接:http://developer.android.com/guide/topics/nfc/index.html
为了指定支持的技术,您必须创建一个xml文件,如下所示:
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<tech-list>
<tech>android.nfc.tech.IsoDep</tech>
<tech>android.nfc.tech.NfcA</tech>
<tech>android.nfc.tech.NfcB</tech>
<tech>android.nfc.tech.NfcF</tech>
<tech>android.nfc.tech.NfcV</tech>
<tech>android.nfc.tech.Ndef</tech>
<tech>android.nfc.tech.NdefFormatable</tech>
<tech>android.nfc.tech.MifareClassic</tech>
<tech>android.nfc.tech.MifareUltralight</tech>
</tech-list>
</resources>我的问题是,在标签处我得到了以下错误:“错误:在期望项目的地方找到标签tech-list”
我的应用程序的目标是2.3.3。我认为这必须在这个目标上起作用。
有什么想法吗?
谢谢!
发布于 2011-07-29 03:29:57
我的应用程序的AndroidManifest.xml文件中接收近场通信意图的活动的代码片段
<activity
android:name=".activity.ClientActivity"
android:screenOrientation="portrait"
android:label="@string/app_name"
android:description="@string/app_name"
android:icon="@drawable/ttlogo">
<intent-filter>
<action
android:name="android.nfc.action.TECH_DISCOVERED"/>
</intent-filter>
<meta-data
android:resource="@xml/nfc_tech_filter"
android:name="android.nfc.action.TECH_DISCOVERED" />
<intent-filter>
<action
android:name="android.nfc.action.TAG_DISCOVERED" />
<category
android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action
android:name="android.intent.action.VIEW" />
<category
android:name="android.intent.category.DEFAULT" />
<data
android:scheme="http"
android:host="www.ttag.be" />
</intent-filter>
</activity>包含过滤器定义的文件位于res/xml/nfc_tech_filter.xml中,如下所示
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Touchatag tag -->
<tech-list>
<tech>android.nfc.tech.NfcA</tech>
<tech>android.nfc.tech.Ndef</tech>
<tech>android.nfc.tech.MifareUltralight</tech>
</tech-list>
<!-- DESFire tag -->
<tech-list>
<tech>android.nfc.tech.NfcA</tech>
<tech>android.nfc.tech.IsoDep</tech>
<tech>android.nfc.tech.NdefFormatable</tech>
</tech-list>
<!-- Any Tag -->
<tech-list>
<tech>android.nfc.tech.NfcA</tech>
</tech-list>
发布于 2013-04-04 12:45:03
android SDK文档:将此文件(您可以任意命名)保存在
<project-root>/res/xml/ 文件夹。
因此,您可能将xml文件保存在错误的文件夹中。(您是否将其保存在<project-root>/res/values/中)
发布于 2012-04-06 01:59:39
将每个<tech>项放在单独的<tech-list>节点中。
https://stackoverflow.com/questions/6841470
复制相似问题