Using java Syntax Highlighting
- public void gotoOptions() { //In my main class
- Intent i = new Intent(this, Options.class);
- startSubActivity(i, ACTIVITY_OPTIONS);
- }
- /////////////// Now my options class:
- package com.android.project.wilfred;
- import android.app.Activity;
- import android.content.SharedPreferences;
- import android.os.Bundle;
- import android.view.View;
- import android.widget.Button;
- import android.widget.RadioGroup;
- public class Options extends Activity implements RadioGroup.OnCheckedChangeListener {
- private String PREFS_NAME;
- private String PREFS_THEME;
- private String PREFS_PUBLICMAP;
- private final SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
- private final SharedPreferences.Editor editor = settings.edit();
- @Override
- protected void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- PREFS_NAME = getString(R.string.p_name);
- PREFS_THEME = getString(R.string.p_theme);
- PREFS_PUBLICMAP = getString(R.string.p_public);
- loadPreferences();
- }
- public void loadPreferences() {
- //TODO: Keep adding to this!
- final SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
- if(settings.getBoolean(PREFS_THEME, false)) setTheme(android.R.style.Theme_Dark);
- else setTheme(android.R.style.Theme_White);
- //TODO: Change to custom colors eventually, for now just 2 themes (black-on-white, white-on-black)
- setOptions();
- }
- public void setOptions() {
- setContentView(R.layout.options);
- RadioGroup o_radioGroupTheme = (RadioGroup) findViewById(R.id.o_radioGroupTheme);
- RadioGroup o_radioGroupMap = (RadioGroup) findViewById(R.id.o_radioGroupMap);
- o_radioGroupTheme.setOnCheckedChangeListener(this);
- o_radioGroupMap.setOnCheckedChangeListener(this);
- //This button handles submitting changed options TODO: disable it if no options to be changed
- Button b_save = (Button) findViewById(R.id.b_save);
- b_save.setOnClickListener(new Button.OnClickListener() {
- public void onClick(View v) {
- editor.commit();
- setResult(RESULT_OK);
- finish();
- }
- });
- //This button cancels changes
- Button b_cancel = (Button) findViewById(R.id.b_cancel);
- b_cancel.setOnClickListener(new Button.OnClickListener() {
- public void onClick(View v) {
- setResult(RESULT_CANCELED);
- finish();
- }
- });
- }
- public void onCheckedChanged(RadioGroup group, int checkedId) {
- if(checkedId == R.id.r_changetheme_white) editor.putBoolean(PREFS_THEME, true);
- if(checkedId == R.id.r_changetheme_black) editor.putBoolean(PREFS_THEME, false);
- if(checkedId == R.id.r_publicmap_yes) editor.putBoolean(PREFS_PUBLICMAP, true);
- if(checkedId == R.id.r_publicmap_no) editor.putBoolean(PREFS_PUBLICMAP, false);
- }
- }
Parsed in 0.040 seconds, using GeSHi 1.0.8.4
Its alot of code, but I really have no idea whats causing the problem and because of that I don't know what i can leave out. If you want to see all the code you can look at our public SVN here: http://projectwilfred.googlecode.com/svn/
Thanks a bundle!!




. You could change your package name into: com.googlecode.projectwilfred. In eclipse using Refactor->Rename on the package folder, should change this easily.

