Reputation: 5619
As the title says I keep getting this error and don't know what I'm missing. I've cleaned the project several times. Here is my code:
startActivity(new Intent(this, UsrPrefs.class));
In the manifest:
<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>
OHHHHHHHHHHHHHHHHHHHH!!!!! Thanks you guys. I thought the UsrPrefs.class was the name of the class so that is what I was using. I see the connection now. DOH!!!!
Upvotes: 0
Views: 82
Reputation: 6751
It's because you defined a class as an activity with one name and starting the other activity which is not registered with that name in the manifest.xml
Replace this:
<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>
with
<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>
Upvotes: 1
Reputation: 132992
Use
startActivity(new Intent(IcyArmActivity.this, UserPreferences.class));
for starting new Activity from main Activity because you have declared UsrPrefs as UserPreferences in manifest
OR
you can declare UsrPrefs
as new Activity in manifest as :
<activity android:name=".UsrPrefs" />
Upvotes: 1
Reputation: 18509
In your menifest the name of activity is UserPreferences.So edit like this
startActivity(new Intent(this, UserPreferences.class));
Upvotes: 1