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 8228089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:20:57+00:00 2026-06-07T16:20:57+00:00

I am trying to establish a settings screen for my Android 4.0+ app. I

  • 0

I am trying to establish a settings screen for my Android 4.0+ app. I can not get the two checkboxes vibratePreference and soundPreference to display. I don’t think UserPreferencesFragment ever instantiates. Below are the files involved. I’ve been on this for a couple of nights and I can not figure out what I’m missing. What am I over looking?

Thanks, PLA

preferences_headers.xml

<preference-headers xmlns:android="http://schemas.android.com/apk/res/android" >

    <header
        android:fragment="com.hometelco.hfa.activities.UserPreferencesFragment"
        android:summary="Home Field Advantage user settings"
        android:title="User Settings" />

</preference-headers> 

preferences.xml

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >

    <PreferenceCategory android:title="User Settings" >
        <CheckBoxPreference
            android:defaultValue="true"
            android:key="vibratePreference"
            android:summary="Vibrate on adds and updates"
            android:title="Vibrate" />
        <CheckBoxPreference
            android:defaultValue="true"
            android:key="soundPreference"
            android:summary="Play sound on adds and updates"
            android:title="Sound" />
    </PreferenceCategory>

</PreferenceScreen>

UserPreferencesActivity.java

package com.hometelco.hfa.activities;

import java.util.List;

import android.preference.PreferenceActivity;
import android.util.Log;

import com.hometelco.hfa.R;

public class UserPreferencesActivity extends PreferenceActivity {
    private static final String TAG = "UserPreferencesActivity";

    public void onBuildHeaders(List<Header> target) {
        Log.i(TAG, "onBuildHeaders before load");
        loadHeadersFromResource(R.xml.preference_headers, target);
        Log.i(TAG, "onBuildHeaders after load");
    }
}

UserPreferencesFragment.java

package com.hometelco.hfa.activities;

import android.os.Bundle;
import android.preference.PreferenceFragment;
import android.util.Log;

import com.hometelco.hfa.R;

public class UserPreferencesFragment extends PreferenceFragment {
    private final static String TAG = "UserPreferencesFragment";

    public void onCreate(Bundle savedInstanceState) {
        Log.i(TAG, "UserPreferencesFragment onCreate");
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.preferences);
    }
}
  • 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-06-07T16:20:58+00:00Added an answer on June 7, 2026 at 4:20 pm

    I apologize. My code was actually working the entire time. I was just not pressing on the settings header. When I did my check-boxes appeared. This is not what I want so I changed PreferenceActivity to the code seen below.

    package com.hometelco.hfa.activities;
    
    import android.os.Bundle;
    import android.preference.PreferenceActivity;
    import android.preference.PreferenceFragment;
    import android.util.Log;
    
    import com.hometelco.hfa.R;
    
    public class UserPreferencesActivity extends PreferenceActivity {
        private static final String TAG = "UserPreferencesActivity";
    
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            Log.i(TAG, "onCreate hasHeaders: " + hasHeaders());
             getFragmentManager().beginTransaction().replace(android.R.id.content,
             new UserPreferencesFragment()).commit();
        }
    /*
        public void onBuildHeaders(List<Header> target) {
            Log.i(TAG, "onBuildHeaders before load");
            loadHeadersFromResource(R.xml.preference_headers, target);
            Log.i(TAG, "onBuildHeaders after load");
        }
    */
        public static class UserPreferencesFragment extends PreferenceFragment {
            private final static String TAG = "UserPreferencesFragment";
    
            public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                Log.i(TAG, "fragment onCreate");
                addPreferencesFromResource(R.xml.preferences);
            }
        }
    }    
    

    Thanks to everyone who helped me find the error of my ways.

    PLA

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

Sidebar

Related Questions

Just trying to establish whether prototype can do something like $$('#ID a:last').css('color','#111'); Any ideas
im trying to establish and access a session from my servlet, but I can't
I'm trying to establish a relationship between two models in Rails but I am
I was trying to establish the licence of the API demos at developer.android.com as
I am trying to establish a HTTPS connection to a server using my app.
I am new to Android platform and trying to establish a http request but
i'm trying to establish an FTP connection within an app. i want to upload
I'm trying to establish workflows for creating new projects and for setting old projects
I'm trying to establish a second database connection to another database on another server.
I am trying to establish upper / lower bound in my stored procedure below

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.