If all you need is a basic AlertDialog with a title, message, and 3 buttons,
just use the AlertDialog.Builder object to create one using the set
positive, neutral, and negative button methods.

No need to create your own layout / view unless you need something fancier
than that.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking


On Fri, Dec 18, 2009 at 8:51 AM, Smelly Eddie <[email protected]> wrote:

> Thorsten:
>
> Create a layout that includes the buttons, images and text as you
> would like them to appear.
>
> Then in your activity create a method to display the layout you ahve
> made. I am including to examples. The first just shows an icon and
> text, and the second shows text and 3 buttons.
>
> ---
> //show custom dfialog with icon
>        private void showCustomDialog(String title, String message) {
>                dialog = new Dialog(this);
>                dialog.setContentView(R.layout.custom_dialog);
>                dialog.setTitle(title);
>                TextView text = (TextView) dialog.findViewById
> (R.id.text);
>                text.setText(message);
>                ImageView image = (ImageView) dialog.findViewById
> (R.id.image);
>                image.setImageResource(R.drawable.red_icon);
>
>                dialog.show();
>        }
>
> // show custom fdialog with 3 buttons
>        private void showLicenseDialog() {
>                dialog = new Dialog(this);
>                dialog.setContentView(R.layout.license_dialog);
>                dialog.setTitle("License Agreement");
>                TextView text = (TextView) dialog.findViewById
> (R.id.text);
>                text.setText(R.string.dialog_license_start);
>                accept = (Button) dialog.findViewById(R.id.accept);
>                accept.setOnClickListener(this);
>                decline = (Button) dialog.findViewById(R.id.decline);
>                decline.setOnClickListener(this);
>                about = (Button) dialog.findViewById(R.id.about);
>                about.setOnClickListener(this);
>
>                dialog.show();
>        }
>
>
> On Dec 18, 5:14 am, Thorsten Kramer
> <[email protected]> wrote:
> > Hi,
> >
> > I'm trying to create an AlertDialog, which has a button bar with three
> > buttons as its view. What is the best practise to do that?
> > - Create a layout file with a LinearLayout and three buttons and inflate
> > that one in my own custom view (subclass of View) or
> > - subclass the AlertDialog class or
> > - ...
> >
> > Thanks!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-beginners%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to