正如标题所说,我一直收到这个错误,并且不知道我错过了什么。我已经把这个项目清理了好几次了。下面是我的代码:
startActivity(new Intent(this, UsrPrefs.class));在清单中:
<application
android:label="@string/app_name" >
<activity
android:name=".IcyArmActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="@string/app_name"
android:name=".UserPreferences"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.PREFS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>哦!谢谢你们。我认为UsrPrefs.class是类的名称,所以这就是我所使用的。我现在明白其中的联系了。哇!
发布于 2013-01-01 01:29:37
这是因为您将一个类定义为具有一个名称的活动,并启动了另一个未在manifest.xml中使用该名称注册的活动
替换为:
<activity
android:label="@string/app_name"
android:name=".UserPreferences"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.PREFS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>使用
<activity
android:label="@string/app_name"
android:name=".UsrPrefs"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.PREFS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>发布于 2013-01-01 01:26:55
在menifest中,活动的名称是UserPreferences.So edit,如下所示
startActivity(new Intent(this, UserPreferences.class));发布于 2013-01-01 01:27:15
使用
startActivity(new Intent(IcyArmActivity.this, UserPreferences.class));用于从主活动启动新活动,因为您已在清单中将UsrPrefs声明为UserPreferences
或
可以在清单中将UsrPrefs声明为新活动,如下所示:
<activity android:name=".UsrPrefs" />https://stackoverflow.com/questions/14104370
复制相似问题