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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:42:39+00:00 2026-06-07T04:42:39+00:00

-EDITED THE MAIN CODE IN THIS BLOCK- This code I am writing is having

  • 0

-EDITED THE MAIN CODE IN THIS BLOCK-
This code I am writing is having an issue at start up. It starts the app GUI and says “We are sorry “Appname” has unfortunately stopped working.”

[Here is the logcat Errors][1]
I’m guessing it has something to do with the start up code here it is:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dhd);

    DialogPreference dp = (DialogPreference) findPreference("mediavolume");
    dp.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {

        public boolean onPreferenceChange(Preference preference,
                Object newValue) {
            SeekBar volumeBar = (SeekBar) findViewById(R.id.seekBar);
            final AudioManager manager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

            volumeBar.setMax(manager
                    .getStreamMaxVolume(AudioManager.STREAM_SYSTEM));
            volumeBar.setProgress(manager
                    .getStreamVolume(AudioManager.STREAM_SYSTEM));

            volumeBar
                    .setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
                        @Override
                        public void onStartTrackingTouch(SeekBar seekBar) {
                            Toast.makeText(volman.this, "Starting", Toast.LENGTH_LONG).show();

                        }

                        @Override
                        public void onStopTrackingTouch(SeekBar seekBar) {
                            Toast.makeText(volman.this, "Now Stopping", Toast.LENGTH_LONG).show();

                        }
                        public void onProgressChanged(SeekBar seekBar,
                                int progress, boolean fromUser) {
                            manager.setStreamVolume(
                                    AudioManager.STREAM_SYSTEM, progress,
                                    AudioManager.FLAG_SHOW_UI);
                            Toast.makeText(volman.this, "Now going Silent", Toast.LENGTH_LONG).show();

                        }
                    });

            return false;
        }
    });
}

private DialogPreference findPreference(String string) {
    return null;
}

}

  • 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-07T04:42:40+00:00Added an answer on June 7, 2026 at 4:42 am

    You have to set content view.

    After super.onCreate(savedInstanceState); add:

    setContentView(R.layout.your_layout);
    

    Edit:

    Here’s what happened.
    You pasted this code into your Activity.

    Eclipse gave you an error that : “The method findPreference(String) is undefined for the type volman”. Which is normal because you have to extend PreferenceActivity rather than Activity.

    You did the quick fix: Create method findPreference(String).

    This created a method that returns null, but made your code compile.

    That’s why you are getting a NullPointerException.

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

Sidebar

Related Questions

I found and edited this code to use jquery to display elements of an
I have this simple piece of code in c++: int main(void) { string text
Edited at the request of commenters. I hope this is compliant. First post! Trying
Edited code - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @Cell;
Edited Question: This should be clear. using System; namespace UpdateDateTimeFields { class Program {
Edited: SOLUTION FOUND. This is strange and not the best solution, but I just
I've edited this post to make it simpler to read, I think. I need
Why is this code note working (the code compiles and run fine, but is
I have this code (Reset.py) that works how I want it to unless I
I have written this code but it will print these stack traces in 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.