Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 843173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:04:57+00:00 2026-05-15T06:04:57+00:00

I see no problem in the code. Help? preferences.xml <?xml version=1.0 encoding=utf-8?> <PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android>

  • 0

I see no problem in the code. Help?

preferences.xml

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">


<ListPreference
android:title="Gender"
android:summary="Are you male or female?"
android:key="genderPref"
android:defaultValue="male"
android:entries="@array/genderArray"
android:entryValues="@array/genderValues" />


<ListPreference
android:title="Weight"
android:summary="How much do you weigh?"
android:key="weightPref"
android:defaultValue="180"
android:entries="@array/weightArray"
android:entryValues="@array/weightValues" />


</PreferenceScreen>

arrays.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

<string-array name="genderArray">
<item>Male</item>
<item>Female</item>
</string-array>
<string-array name="genderValues">
<item>male</item>
<item>female</item>
</string-array>

<string-array name="weightArray">
<item>120</item>
<item>150</item>
<item>180</item>
<item>210</item>
<item>240</item>
<item>270</item>
</string-array>
<string-array name="weightValues">
<item>120</item>
<item>150</item>
<item>180</item>
<item>210</item>
<item>240</item>
<item>270</item>
</string-array>

</resources>

Preferences.java:

 package com.dantoth.drinkingbuddy;


 import android.os.Bundle;
 import android.preference.PreferenceActivity;


 public class Preferences extends PreferenceActivity {
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 addPreferencesFromResource(R.xml.preferences);

 };
 }

butts.xml (idk why it’s butts but I’ve gotten used to it now. really just sets up the menu button)

<?xml version="1.0" encoding="utf-8"?>
 <menu xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:id="@+id/settings"
    android:title="Settings"
    android:icon="@drawable/ic_menu_settings" />
  <item android:id="@+id/archive"
    android:title="Archive"
    android:icon="@drawable/ic_menu_archive" />
  <item android:id="@+id/new_session"
    android:title="New Session"
    android:icon="@drawable/ic_menu_new" />
  <item android:id="@+id/about"
    android:title="About"
    android:icon="@drawable/ic_menu_about" />       
 </menu>

within DrinkingBuddy.java:

 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
    case R.id.settings:  

        startActivity(new Intent(this, Preferences.class));
        return true;



    case R.id.archive:     Toast.makeText(this, "Expect to see your old drinking sessions here.", Toast.LENGTH_LONG).show();
        return true;

     //ETC.


 } return false;

That’s it. I can press the menu button on the phone and see the menu items I created, but when I click on the “Settings” (r.id.settings) it FC. Do I have to do anything to the manifest/other thing to get this to work??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T06:04:57+00:00Added an answer on May 15, 2026 at 6:04 am

    You need to have .Preferences listed as an <activity> in your manifest, if you don’t already.

    Also, check the output of logcat (either from the LogCat view in Eclipse, or by running adb logcat on the command line) to get an idea of what the actual problem is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The easiest way to see the problem is checking the code here: http://www.studioimbrue.com/beta What
Please go to: http://jlecologia.com/page1c.html to see the problem The top box look fine but
Please see my pseudo-code below. The code comments should explain my problem. I'm new
I've a problem with CakePHP __() function. Please see the code below : $options
I am having a problem using the signedCMS.decode routine. See the code below. The
I did not see anything that address my particular code problem. I have a
I have this strange problem I need some help with. This menu code goes
I read 2 C# chat source code & I see a problem: One source
Can anyone see the problem with this code? When 'out' is returned, it has
I see this problem on and off again in my PHP coding, and I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.