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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:07:56+00:00 2026-06-10T05:07:56+00:00

I extend a Dialog java code public class Dialog_query extends Dialog implements OnClickListener {

  • 0

I extend a Dialog

java code

public class Dialog_query extends Dialog implements OnClickListener {   

}  

Through the XML defines a interface
enter image description here

Now want to select date by clicking on 日期1
The code is as follow
Recorded as:code button

java button

Button btn=(Button)findViewById(R.id.BtnDate);           
        btn.setOnClickListener(new View.OnClickListener() {   
          public void onClick(View v) {   
            new DatePickerDialog(Dialog_query.this,   
                d2,   
                dateAndTime.get(Calendar.YEAR),   
                dateAndTime.get(Calendar.MONTH),   
                dateAndTime.get(Calendar.DAY_OF_MONTH)   
                ).show();   
          }   
        }); 

Now the question is,point out”The constructor DatePickerDialog(Dialog_query, DatePickerDialog.OnDateSetListener, int, int, int) is undefined”

Later found in here to add”Toast.makeText(LoginSuccess.this, “About agile software 1.0″, Toast.LENGTH_LONG).show();”

also point out”The method makeText(Context, CharSequence, int) in the type Toast is not applicable for the arguments (Dialog_query, String, int)”

But the “code button” is right in Activity.

Why in the extend cases will prompt such a mistake?

  • 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-10T05:07:58+00:00Added an answer on June 10, 2026 at 5:07 am

    You’re Dialog_query inheritates from dialog. But the Dialog class does not inheritate from Activity: http://developer.android.com/reference/android/app/Dialog.html

    The constructor of DatePickerDialog needs a context or activity. Put the name of your activity instead of Dialog_query.this

    new DatePickerDialog(ActivityName.this,   
                    d2,   
                    dateAndTime.get(Calendar.YEAR),   
                    dateAndTime.get(Calendar.MONTH),   
                    dateAndTime.get(Calendar.DAY_OF_MONTH)   
                    ).show(); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

package com.em.progressb; public class progressb extends Activity implements OnClickListener { ProgressDialog dialog; int increment;
i try to work with spinner on dialog public class data extends Dialog {
I have a class that extends android.app.Dialog, the layout is done in an xml
CustomDialogExample.java public class CustomDialogExample extends Activity { /** Called when the activity is first
public class ExampleActivity extends Activity { public static final int DIALOG_DOWNLOAD_PROGRESS = 0; private
Tell me, how to make it impossible to close the window which extends org.eclipse.swt.widgets.Dialog
I extend a class with multiple constructors. I add a final field in my
I can extend an inner class/trait inside the outer class or inside a class
So I am trying extend the base Application class and add member variables to
I have class that extend FragmentActivity in it I add fragment to layout as

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.