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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:04:24+00:00 2026-06-09T12:04:24+00:00

Why not AlertDialogBuilder builder = new AlertDialogBuilder(this); builder.setTitle(foo); instead of AlertDialog.Builder builder = new

  • 0

Why not

AlertDialogBuilder builder = new  AlertDialogBuilder(this);
builder.setTitle("foo");

instead of

AlertDialog.Builder builder = new  AlertDialog.Builder(this);
builder.setTitle("foo");

Update: I want to know the reason behind this kind of writing/organization

  • 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-09T12:04:25+00:00Added an answer on June 9, 2026 at 12:04 pm

    Builder is the static inner class inside the AlertDialog class. So to create a Builder class object, you need to call AlertDialog.Builder.

    As there is no class like AlertDialogBuilder so you cannot do that.

    If you want you can also use as like bellow.

    Builder builder = new Builder(this);
    builder.setTitle("foo");
    

    But to use like this you need to import the Builder class to your class like

    import android.app.AlertDialog.Builder;
    

    instead of just

    import android.app.AlertDialog;
    

    A simple example

    class A{
         static class B{}
    }
    

    you cannot use

    AB obj = new AB();
    

    you have to use

    A.B obj = new A.B();
    

    Hope you are clear now.

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

Sidebar

Related Questions

@Override protected Dialog onCreateDialog (int id) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.instant_alert_screen_title); builder.setInverseBackgroundForced(true);
Here is my code for Confirm Dialogue, written in onTouchListener: new AlertDialog.Builder(getApplicationContext()) .setTitle(Submit Quiz)
Here's my code: private void makeDialog2() { AlertDialog.Builder about = new AlertDialog.Builder(getContext()); about.setTitle(You Won!);
For some reason, I can not get this dialog to show up on the
I have an AlertDialog in the activity I used, as: AlertDialog.Builder ad = new
Not sure whats going on here, or what could be the integer in this
NOT USING A XML PARSER I want to get the contents of the XML
Not sure how to ask this, but i'll give it a try: I have
I am trying to show a alertdialog but i keep getting this error 01-24
UPDATED: Hi i'm using spinner within AlertDialog.Builder to show the list of options to

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.