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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:47:48+00:00 2026-06-07T01:47:48+00:00

Using Android API 14 or higher, what is the easiest way to make a

  • 0

Using Android API 14 or higher, what is the easiest way to make a dialog box? All I want is a few lines of text, OK button, and Cancel button. The Cancel button closes the dialog, the OK button performs some method that I have.

The reason I ask is because I’m going through a few different tutorial books and many of them seem to make dialog creation an overly complicated process. So I want the absolute simplest way to do this (fewest lines of code).

  • 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-07T01:47:50+00:00Added an answer on June 7, 2026 at 1:47 am

    The proper way is use a DialogFragment but if you want the fewest lines of code then the below code will work just fine:

    public void showMessageDialog(Context context, int message, int title) {
        new AlertDialog.Builder(context)
        .setTitle(title)
        .setMessage(message)
        .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                // TODO: Ok click stuff
            }
        })
        .setNegativeButton(R.string.cancel, null)
        .show();
    }
    

    The variables message and title are both String resource identifiers.

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

Sidebar

Related Questions

I want to check in using facebook android sdk (graph api), I am trying
I'm using Android with Api level 8 and I want to get the Address
I want to develop facebook client in android using fbrocket api.but,this api only allows
I followed this tutorial to get started using Android host api with an Arduino
Sending Email in Android using JavaMail API without using the default/built-in app I'm trying
I'm using the Android 2.1 API. I download from the web, through ksoap Protocol,
I'm using Android and Google Maps at API level 10, and I get latitude
I have developed a simple application using SDK(Android: 3.2[API-13]) for, to display Google banners.
I'm using the cameraPreview sample coming with the Android API demos. The problem is,
I'm using Google API 8 (Android 2.2) with support package v4. It doesn't give

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.