I’m trying to add a Preference screen to my app.
Preferences.java:
public class Preferences extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.layout.preferences);
}
}
preferences.xml
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="General Settings">
<RingtonePreference
android:name="Ringtone"
android:summary="Select a Ringtone for recieved messages"
android:title="Rington"
android:key="ringtonPref" />
</PreferenceCategory>
<PreferenceCategory
android:title="Account Settings">
<Preference
android:title="Sign Out"
android:summary="Sign out of current account"
androidKey="signOut" />
</PreferenceCategory>
</PreferenceScreen>
and AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="steamanywhere.com"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
android:debuggable="true">
<activity android:name=".SteamAnywhere"
android:label="@string/app_name">
</activity>
<acitivity android:name="steamanywhere.com.Preferences" >
</acitivity>
<activity android:name=".StartupScreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:enabled="true" android:name=".WebEventListener" />
</application>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>
The Preferences activity is started in SteamAnywhere.java with the following code:
Intent preferenceIntent = new Intent(this, steamanywhere.com.Preferences.class);
startActivity(preferenceIntent);
On startActivity(preferenceIntent); I get the following exception:
android.content.ActivityNotFoundException: Unable to find explicit activity class {steamanywhere.com/steamanywhere.com.Preferences}; have you declared this activity in your AndroidManifest.xml?
But it is declared.. Any ideas?
I’ve looked through many similar questions but none of the answers work for me.
I think the answer may be in your xml
You’ve spelt
activitywrong.Also, why do you not just say?