Hello all,
When I click on Menu, then settings I receive an error that says, "The
application Snake (process com.brooks.snake) has stopped unexpectedly.
Please try again. I have run it in debug and it seems happen at the
startActivity function. Here is the code most of my code. Where did I
go wrong?
Override for onOptionsItemSelected:
@Override
public boolean onOptionsItemSelected(MenuItem item){
switch(item.getItemId()){
case R.id.settings:
Intent i = new Intent(this,Settings.class);
startActivity(i);
return true;
}
return false;
}
Entire Settings.java code:
package com.brooks.snake;
import android.os.Bundle;
import android.preference.PreferenceActivity;
public class Settings extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.settings);
}
}
Entire settings.xml:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference android:key="music"
android:title="@string/music_title"
android:summary="@string/music_summary"
android:defaultValue="true" />
<CheckBoxPreferance android:key="hints"
android:title="@string/hints_title"
android:summary="@string/hints_summary"
android:defaultValue="true" />
</PreferenceScreen>
Entry in Manifest.xml
<activity android:name=".Settings"
android:label="@string/settings_title">
</activity>
I really need to get this project finished today if possible.
Thanks in advance,
Kevin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---