0

Hello and thanks for the help.

I am using the following code to generate a generic AlertDialog on my MapView Overlay (all is working)....I would like to know how or what to change to call a custom AlertDialog called custom.xml

   @Override
    protected boolean onTap(int i) 
    {

        //final Dialog dialoggg = new Dialog(mContext);
//      dialoggg.setContentView(R.layout.custom);
//        LayoutInflater inflater = LayoutInflater.from(mContext);
//        View dialogview = inflater.inflate(R.layout.custom, null);

        //when you tap on the marker this will show the informations provided by you when you create in the
        //main class the OverlayItem
        OverlayItem item = mOverlays.get(i);
        AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
        builder.setMessage(item.getSnippet())
               .setTitle(item.getTitle())
               .setCancelable(true)
               .setPositiveButton("View Details", new DialogInterface.OnClickListener() {

                   public void onClick(DialogInterface dialog, int id) {
                       Intent intent = new Intent(new Intent("com.GoGoGo.Play.LINEUP"));
                       mContext.startActivity(intent);
                   }
               })
               .setNegativeButton("Close window", new DialogInterface.OnClickListener() {
                   public void onClick(DialogInterface dialog, int id) {
                       dialog.dismiss();
                   }
               });
        AlertDialog alert = builder.create();
        alert.show();
        return true;
    }

Nothing too fancy really I just want to change the background color of the AlertDialog to black...(from the standard gray).

Your time and help are greatly appreciated. -thx

AhabLives
  • 1,308
  • 6
  • 22
  • 34
  • Just a tip, use DialogFragment instead of AlertDialog – Tobrun Jan 21 '13 at 19:24
  • @user1281750 how is DialogFagment different ? Thanks? – AhabLives Jan 21 '13 at 19:43
  • You are using dialog the not-android way (using showDialog function in your activity used to be the right way). This will result in exceptions (almost never but you will see them turn up in developer console). Since the upcome of fragments the showDialog method was deprecated and you should use DialogFragment instead. A dialogFragment is similair to a dialog only its wrapped inside a fragment. This fragment will handle all configurationChanges for you. A dialogFragment has an onCreateDialog method where you can paste the code you used in this post. For examples check the Android reference. – Tobrun Jan 21 '13 at 19:47

0 Answers0