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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 495k
  • Answers 495k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You could overwrite the default template. Use Triggers to specific… May 16, 2026 at 11:19 am
  • Editorial Team
    Editorial Team added an answer You need to output the HTML for a link. Something… May 16, 2026 at 11:19 am
  • Editorial Team
    Editorial Team added an answer $new_array = array(); $count = 0; foreach ($original_array as $key… May 16, 2026 at 11:19 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Thanks to the help in a previous question , I've got the following code
UPDATE The issue is solved, all the code you can see works. Hello! I
SOLVED see Edit 2 Hello, I've been writing a Perl program to handle automatic
I'm setting up some VBA in excel to compare two dates to see if
Originally: I thought this was a circular reference problem........turns out it's not. The problem
I am new to both openGL and android development so please forgive me if
I have a problem with a site I am redesigning and the problem is
Just starting out with jQuery and this problem seems to be impossible to me.
This code compiles and works as expected (it throws at runtime, but never mind):
I wrote two applictions which comunicate by socket. This is the code: Server: import

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.