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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:24:14+00:00 2026-05-30T05:24:14+00:00

For a school project, I’m building an application using PreferenceScreen s as a framework.

  • 0

For a school project, I’m building an application using PreferenceScreens as a framework.
I’ve created 2 new classes to suit my needs: SeekBarDialogPreference (designed to handle volumes and brightness) and DigitalPreference (for everything else).

class SeekBarDialogPreference extends DialogPreference {

    static HashMap<String, Integer> maxValues = new HashMap<String, Integer>(6);
    AudioManager am = (AudioManager) APP.getContext().getSystemService(Context.AUDIO_SERVICE);
    View views = new View(APP.getContext());
    SeekBar sb;
    CheckBox cb;

    @Override
    protected void onBindDialogView(View view) {
        sb = (SeekBar) views.findViewById(R.id.seekbar);
        cb = (CheckBox) views.findViewById(R.id.unchanged_check);
        sb.setMax(maxValues.get(this.getKey()));

        super.onBindDialogView(view);
    }

    @Override
    protected void onDialogClosed(boolean positiveresult) {
        super.onDialogClosed(positiveresult);
        if (positiveresult) {
            Editor editor = getEditor();
            editor.putInt(this.getKey(), cb.isChecked() ? -1 : sb.getProgress());
            editor.commit();
        }
    }

    void show() {
        onClick();
    }
}

and the DigitalPreference

public class DigitalPreference extends ListPreference{

    void show(){
        onClick();
    }

Here’s the unifying TopPage, which is the main page

public class TopPage extends PreferenceActivity {

    @Override
    public void onCreate(Bundle allthethings) {
        super.onCreate(allthethings);
        Map<String, ?> shareprefs = PreferenceManager.getDefaultSharedPreferences(this).getAll();
        addPreferencesFromResource(R.xml.prefs);

    }

    @Override
    public void onStart() {
        getPrefs();
    }

    private SeekBarDialogPreference makeSeekBar(Preference pref) {
    return (SeekBarDialogPreference) findPreference(pref.getKey());
    }

    private DigitalPreference makeDigital(Preference pref) {
        return (DigitalPreference) findPreference(pref.getKey());
    }

    private void setClickListener(Preference preference, final boolean isSeekBar) {
        preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {

            public boolean onPreferenceClick(Preference pref) {
                if (isSeekBar) {
                    makeSeekBarDialogPreference(pref).show();
                } else {
                    makeDigitalPreference(pref).show();
                }
                return true;
            }
        });
    }

    public void getPrefs() {

        SeekBarDialogPreference Ringvolume_preference = (SeekBarDialogPreference) findPreference("Ringvolume_preference");
        setClickListener(Ringvolume_Preference, true);

        //Instantiated each Preference and attached a ClickListener to each
}

I have all of the preferences declared in res/xml/prefs.xml. Now whenever I run the app, I get an immediate force close. I suspect there’s something wrong with my Manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.gobernador"
      android:versionCode="1"
      android:versionName="0.1">
    <uses-sdk android:minSdkVersion="5"
              android:targetSdkVersion="10"/>

    <application android:label="@string/app_name"
             android:name="APP">
        <activity android:name=".TopPage"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

I’ve referenced Android: launch a custom Preference from a PreferenceActivity, among other stackoverflow questions, but I haven’t been able to work out the problem.

If someone could shepherd me in the right direction, you would be getting me out of a huge rut. Thanks!

EDIT: After swimming through the logcat, I found an exception thrown in my prefs.xml file.

<?xml version="1.0" encoding="UTF-8"?>

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

    <PreferenceScreen android:title="Volumes"
                      android:summary="Ring, Notification, System, etc.">

        <com.gobernador.SeekBarDialogPreference android:key="Ringvolume_preference"
                                        android:title="Ring Volume"
                                        android:summary=""
                                        android:dialogLayout="@layout/seekbar_layout"/>

        <com.gobernador.SeekBarDialogPreference android:key="Notifyvolume_preference"
                                        android:title="Notification Volume"
                                        android:summary=""
                                        android:dialogLayout="@layout/seekbar_layout"/>
... and so on

where it tries to access the SeekBarDialogPreference. Why isn’t it working?

EDIT: The Exception being thrown is a NoSuchMethodException: SeekBarDialogPreference(Context,AttributeSet). I defined that method, what did I miss?

  • 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-30T05:24:16+00:00Added an answer on May 30, 2026 at 5:24 am

    I found my solution. It was a java error. I failed to list my constructors for SeekBarDialogPreference and DigitalPreference as public, so the system could not call them.

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

Sidebar

Related Questions

I'm working on a school project desktop application in c# using Visual Studio 2010
I have a school project in which I have to implement a chat application,
I'm using SVN with Google Code Project Hosting for a school project. As the
I'm building a interpreter/compiler for a school project (well now its turning into a
I'm currently working on a school project in Eclipse (We have just started using
For my school project, I am working on a database management application. It is
Hi I'm really new to php/mysql. I'm working on a php/mysql school project with
As a school project we've created a C# XNA 4.0 Game that runs perfectly
I am creating a school project of music player and already created the GUI.
For a school project, I am writing an iOS iPad application in which the

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.