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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:33:12+00:00 2026-06-17T04:33:12+00:00

CODE this.getApplicationContext().getContentResolver().registerContentObserver( android.provider.Settings.System.CONTENT_URI, true, new ContentObserver(new Handler()) { public void onChange(boolean selfChange) { Toast.makeText(audioServices.this,

  • 0

CODE

         this.getApplicationContext().getContentResolver().registerContentObserver(
              android.provider.Settings.System.CONTENT_URI, 
              true, new ContentObserver(new Handler()) {
                public void onChange(boolean selfChange) {
                  Toast.makeText(audioServices.this, "Working..", Toast.LENGTH_SHORT).show();
                  //dispVC();
                  dialog = new Dialog(audioServices.this);
                    dialog.setContentView(R.layout.vc);

                    // set the custom dialog components - text, image and button
                    Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK);
                    // if button is clicked, close the custom dialog
                    dialogButton.setOnClickListener(new View.OnClickListener() {
                        public void onClick(View v) {
                            dialog.dismiss();
                        }
                    });
                      dialog.show();
                  //System.out.println("Works!");
                }
            });

This is the logcat.
Note – 01-09 17:54:43.137: E/AndroidRuntime(7210): at com.torcellite.popupvc.audioServices$1.onChange(audioServices.java:59)

Line 59 is dialog.show();

—EDIT—

So, I changed the code to this.

Intent dialogIntent = new Intent(audioServices.this, vcDialog.class);
                    dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    audioServices.this.startActivity(dialogIntent);

My app still crashes. This is the logcat.

  • 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-17T04:33:13+00:00Added an answer on June 17, 2026 at 4:33 am

    A service doesn’t have any UI elements, so can’t show a dialog box. A dialog can only be added from an Activity context. You can either call an activity that does have a UI, with a dialog theme if you’d like or it might be better to create a notification which is the preferred option for Android alerts.

    EDIT

    Based on your new code, your intent is fine. Instead add the following to your manifest in the application tag:

    <activity android:name=".vcDialog" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Code first: AssetManager mgr = DeviceListActivity.this.getApplicationContext().getAssets(); try { Log.e(Glenn:, address); FileOutputStream fout = mgr.openFd(device/device_address.txt).createOutputStream();
I am using this call: Secure.getString(getApplicationContext().getContentResolver(), Secure.ANDROID_ID); To get a UID for the device.
Here is my code : This is my handleMessage Function : public void handleMessage(Message
This is my current code: public void onClick(View v) { final Intent pickIntent =
This is my code: Activity: @Override public void onCreate(Bundle savedInstanceState) { ... Intent intent
Code This is my little game of pig. I only got it coded for
I want to code this part of a VB6 application in c#. How can
I'm trying to code this site (keyword trying) and I'm trying to figure out
Modified the code this time the objective to count the line of code was
Is it possible to code this sequence of events once an iPhone app has

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.