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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:55:20+00:00 2026-06-13T01:55:20+00:00

I got a problem with a really, really simple AlertDialog that creates my About

  • 0

I got a problem with a really, really simple AlertDialog that creates my About dialog with three choices. Have a look at how it looks like on an emulator, my HTC Sensation and a Galaxy S2:

AlertDialog on three different devices

The dialog is created by this (pseudo) code:

builder.setPositiveButton("OK", null);
builder.setNeutralButton("Disclaimer", [...]);
builder.setNegativeButton("Jetzt zum Market", [...]);

It is so simple, I never thought about maximum text lengths differing so much on different devices! Plus: I think Samsung’s tearing apart of “Disclaimer” is such a mess, not to talk about the whole word “Market” missing.

How am I supposed to create a simple AlertDialog when this already is a problem?
Any clues? Think of a device that sets such a large font that even “Cancel” does not fit any more! sigh How can I prevent such things?

Thanks for advices!!

  • 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-13T01:55:21+00:00Added an answer on June 13, 2026 at 1:55 am

    The answer from Drew DeNardo is almost correct.

    The myDialog.getButton(BUTTON_POSITIVE) is returning null because it was not been created.

    You need to override onShow:

    final AlertDialog alert= builder.create();
    
    alert.setOnShowListener(new DialogInterface.OnShowListener() {
    
        @Override
        public void onShow(DialogInterface dialog) {
    
            float textSize = 15.0f;
    
            Button positive = alert.getButton(AlertDialog.BUTTON_POSITIVE);
            positive.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize);
    
            Button neutral = alert.getButton(AlertDialog.BUTTON_NEUTRAL);
            neutral.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize);
    
            Button negative = alert.getButton(AlertDialog.BUTTON_NEGATIVE);
            negative.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize);
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a simple problem that really has me stumped. I have a master
It's a really simple problem. I've got HTML code like this : <div> <img
I've got this simple problem that is really making me crazy. I've got a
I've got a weird problem that I can't understand... I have a simple HelloWorld
I'm having a problem that i'm sure that it's really simple to solve but
I've got a really simple problem but I just can't sort it, fairly new
I've got a problem which seems simple at first, but really isn't. I'm storing
Okey so I got a really wierd problem that I can't understand. i got
Really weird problem. I have a tableView that pulls data out of a Core
Maybe something really simple, I got really big problem with... ORM result. I'm loading

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.