kaveer
8/27/2017 - 4:31 PM

Alert Dialog

pop up message

  Context context = GenerateListActivity.this;
                    LinearLayout layout = new LinearLayout(context);
                    layout.setOrientation(LinearLayout.VERTICAL);

                    final EditText item = new EditText(GenerateListActivity.this);
                    item.setHint("Item");
                    item.setInputType(InputType.TYPE_CLASS_TEXT);
                    layout.addView(item);

                    final EditText price = new EditText(GenerateListActivity.this);
                    price.setHint("Price");
                    price.setInputType(InputType.TYPE_CLASS_NUMBER);
                    layout.addView(price);

                    final EditText quantity = new EditText(GenerateListActivity.this);
                    quantity.setHint("Quantity");
                    quantity.setInputType(InputType.TYPE_CLASS_NUMBER);
                    layout.addView(quantity);

                    AlertDialog.Builder popUpMessage = new AlertDialog.Builder(GenerateListActivity.this);
                    popUpMessage.setMessage("Click on an item to edit the price and quantity")
                            .setTitle("Information")
                            .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int id) {

                                }
                            });
                    popUpMessage.setIcon(R.drawable.appicon);
                    popUpMessage.setView(layout);
                    popUpMessage.create();
                    popUpMessage.show();
  AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setMessage("TEst")
                    .setTitle("title here")
                    .setPositiveButton("ok", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            // CONFIRM
                        }
                    })
                    .setNegativeButton("cancel", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            // CANCEL
                        }
                    });
            // Create the AlertDialog object and return it
            builder.create();
            builder.show();