這是在我的logcat上顯示的錯誤,當我在Eclipse上爲NFC運行TagViewer.java時。我正在運行一個NFC程序,但基本上它運行的是一段時間內該程序自行關閉的時間。未知的意圖意圖
08-29 14:06:33.677: E/ViewTag(22056): Unknown intent Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.android.nfc/.TagViewer }
這是從我的Android清單。我猜測,錯誤是從這裏,因爲錯誤android.intent.action.MAIN
等這一行。
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.nfc"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-feature android:name="android.hardware.nfc" android:required="true"/>
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="16" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".TagViewer"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</intent-filter>
</activity>
</application>
</manifest>
這是從我的java和基本的最後一行,當我把//程序將不會關閉,但它會顯示像一個白色page.However標題NFC仍表現出我這樣知道它稍工作
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTagContent = (LinearLayout) findViewById(R.id.tag_viewer);
mTitle = (TextView) findViewById(R.id.title);
resolveIntent(getIntent());
}
在上面的XML你有嵌套在另一個意圖過濾器意圖過濾器。這是不正確的。 –
@NFCguy所以我應該擺脫第二個意圖 - 過濾器吧?同樣的問題,我會在我的logcat上得到同樣的錯誤 – user1602030
第二個intent過濾器在*第一個裏面被聲明,這是不正確的。應該在第一個之後(或之前)宣佈。但是,我不知道這與您所具體的錯誤有什麼關係。也許從logcat顯示更多的線可以提供更多的洞察力。 –