Example usage for android.app AlertDialog show

List of usage examples for android.app AlertDialog show

Introduction

In this page you can find the example usage for android.app AlertDialog show.

Prototype

public void show() 

Source Link

Document

Start the dialog and display it on screen.

Usage

From source file:com.honeycomb.cocos2dx.Soccer.java

public void quitGame(JSONObject prms) {
    AlertDialog.Builder exitbuilder = new AlertDialog.Builder(this);
    exitbuilder.setTitle("Girl Superhero").setMessage(com.honeycomb.cocos2dx.R.string.QUIT_MESSAGE)
            .setCancelable(false).setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    AndroidNDKHelper.SendMessageWithParameters("resetListener", getDict());
                }//from   ww  w  . jav a  2  s .c  o  m
            }).setNegativeButton("No", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
    AlertDialog stopalert = exitbuilder.create();
    stopalert.show();
}

From source file:com.honeycomb.cocos2dx.Soccer.java

public void askForRate(JSONObject prms) {
    AlertDialog.Builder exitbuilder = new AlertDialog.Builder(this);
    exitbuilder.setTitle("Rate 2 Planes").setMessage(com.honeycomb.cocos2dx.R.string.Rate).setCancelable(false)
            .setPositiveButton("Rate It Now", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    rateButtonClicked(getDict());
                }/*from   w w w .ja v a 2s . co  m*/
            }).setNegativeButton("No,Thanks", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                    AndroidNDKHelper.SendMessageWithParameters("rated", getDict());
                }
            });
    AlertDialog stopalert = exitbuilder.create();
    stopalert.show();
}

From source file:com.njlabs.amrita.aid.landing.Landing.java

private void setupGrid() {

    GridView gridView = (GridView) findViewById(R.id.landing_grid);
    gridView.setAdapter(new LandingAdapter(baseContext));
    gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override/* ww w .j av a 2  s.c o  m*/
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            String name = ((TextView) view.getTag(R.id.landing_text)).getText().toString();
            switch (name) {
            case "About Amrita":
                // ABOUT AMRITA
                startActivity(new Intent(baseContext, Amrita.class));
                break;
            case "Announcements":
                Snackbar.make(parentView, "Announcements is under construction", Snackbar.LENGTH_SHORT).show();
                break;
            case "Academic Calender":
                // ACADEMIC CALENDER
                startActivity(new Intent(baseContext, Calender.class));
                break;
            case "Amrita UMS Login":
                // AUMS
                startActivity(new Intent(baseContext, AumsActivity.class));
                break;
            case "Train & Bus Timings":
                // TRAIN & BUS INFO
                final CharSequence[] transportationOptions = { "Trains from Coimbatore", "Trains from Palghat",
                        "Trains to Coimbatore", "Trains to Palghat", "Buses from Coimbatore",
                        "Buses to Coimbatore" };
                AlertDialog.Builder transportationDialogBuilder = new AlertDialog.Builder(baseContext);
                transportationDialogBuilder.setTitle("View timings of ?");
                transportationDialogBuilder.setItems(transportationOptions,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int item) {
                                // Showing Alert Message
                                Intent trainBusOpen = new Intent(baseContext, TrainBusInfo.class);
                                trainBusOpen.putExtra("type", transportationOptions[item]);
                                startActivity(trainBusOpen);
                            }
                        });
                AlertDialog transportationDialog = transportationDialogBuilder.create();
                transportationDialog.show();
                break;

            case "GPMS Login":
                // GPMS LOGIN
                startActivity(new Intent(baseContext, GpmsActivity.class));
                break;
            case "Curriculum Info":
                // CURRICULUM INFO
                final CharSequence[] items_c = { "Aerospace Engineering", "Civil Engineering",
                        "Chemical Engineering", "Computer Science Engineering",
                        "Electrical & Electronics Engineering", "Electronics & Communication Engineering",
                        "Electronics & Instrumentation Engineering", "Mechanical Engineering" };
                AlertDialog.Builder departmentDialogBuilder = new AlertDialog.Builder(baseContext);
                departmentDialogBuilder.setTitle("Select your Department");
                departmentDialogBuilder.setItems(items_c, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int item) {
                        // Showing Alert Message
                        Intent curriculum_open = new Intent(baseContext, Curriculum.class);
                        curriculum_open.putExtra("department", items_c[item]);
                        startActivity(curriculum_open);
                    }
                });
                AlertDialog departmentDialog = departmentDialogBuilder.create();
                departmentDialog.show();
                break;

            case "News":
                // NEWS
                startActivity(new Intent(baseContext, NewsActivity.class));
                break;
            default:
                Toast.makeText(baseContext, String.valueOf(i), Toast.LENGTH_SHORT).show();
            }
        }
    });
}

From source file:com.bringcommunications.etherpay.SendActivity.java

private void dsp_txid_and_exit() {
    /*//  www.ja  v a  2s.c om
    TextView txid_view = (TextView) findViewById(R.id.txid);
    txid_view.setText(txid);
    if (auto_pay.equals("true")) {
      String msg = txid.isEmpty() ? "transaction failed" : "your transaction was sent successfully";
      Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
      NavUtils.navigateUpFromSameTask(context);
      this.finish();
    } else
    */
    {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        String title = txid.isEmpty() ? "Error" : "Transaction Sent";
        String msg = txid.isEmpty()
                ? "An error occurred while attempting this transaction -- press OK to continue"
                : "your transaction was sent successfully -- press OK to continue";
        builder.setTitle(title);
        builder.setMessage(msg);
        builder.setCancelable(true);
        builder.setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                dialog.cancel();
                NavUtils.navigateUpFromSameTask(context);
                context.finish();
            }
        });
        AlertDialog alert = builder.create();
        alert.show();
    }
}

From source file:com.njlabs.amrita.aid.gpms.ui.GpmsActivity.java

public void openApply(View v) {
    final String[] items = { "Day Pass", "Home Pass" };
    AlertDialog.Builder builder = new AlertDialog.Builder(baseContext);
    builder.setCancelable(true);//from w  w w  .jav a2s .  c o m
    builder.setTitle("Pass type ?");
    builder.setItems(items, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialogList, int item) {
            Intent intent = new Intent(baseContext, PassApplyActivity.class);
            intent.putExtra("pass_type", items[item]);
            if (relays != null && relays.size() > 0 && identifier != null) {
                intent.putParcelableArrayListExtra("relays", relays);
                intent.putExtra("identifier", identifier);
            }
            startActivity(intent);
        }
    });
    AlertDialog alertDialog = builder.create();
    alertDialog.show();
}

From source file:com.njlabs.amrita.aid.aums.AumsActivity.java

private void semesterPicker(final StringCallback stringCallback) {
    final String[] items = { "1", "2", "Vacation 1", "3", "4", "Vacation 2", "5", "6", "Vacation 3", "7", "8",
            "Vacation 4", "9", "10", "Vacation 5", "11", "12", "Vacation 6", "13", "14", "15" };
    AlertDialog.Builder builder = new AlertDialog.Builder(baseContext);
    builder.setCancelable(true);//  ww w. j ava  2s.  co m
    builder.setTitle("Select a Semester");
    builder.setItems(items, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            stringCallback.onFinish(items[which]);
        }
    });
    AlertDialog alertDialog = builder.create();
    alertDialog.show();
}

From source file:nl.terr.tabweave.TabWeave.java

public void refreshTabList() {
    try {//  ww  w . j a  v a  2 s  .c  o  m
        if (checkPreferencesComplete()) {
            new RefreshTabList().execute();
        } else {
            showSettings();
        }
    } catch (Exception e) {
        AlertDialog alert = createAlertDialog(this, e.getClass().toString(), e.getMessage());
        alert.show();
    }
}

From source file:de.dmxcontrol.fragment.ActionSelectorFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView");

    LinearLayout actionButtons = (LinearLayout) inflater.inflate(R.layout.action_selector_fragment, container,
            false);/*from  w ww  .j a va  2 s.c o m*/

    ViewGroup vg = (ViewGroup) actionButtons.findViewById(R.id.action_selector_scroll);
    scrollView = vg;

    bDeviceAction = (Button) actionButtons.findViewById(R.id.button_device_action);
    bDeviceAction.setOnClickListener(this);
    bDeviceAction.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            try {
                AlertDialog.Builder alert = new AlertDialog.Builder(v.getContext());
                alert.setTitle("Parameter");
                final DeviceManagerDialog view = new DeviceManagerDialog(alert.getContext());
                alert.setView(view);
                alert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        try {
                            ServiceFrontend.get().sendMessage(view.GetDeviceMetadata().getBytes());
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    }
                });
                AlertDialog alertDialog = alert.create();
                alertDialog.show();
                return true;
            } catch (Exception e) {
                return false;
            }
        }
    });

    bColorAction = (Button) actionButtons.findViewById(R.id.button_color_action);
    bColorAction.setOnClickListener(this);

    bIntensityAction = (Button) actionButtons.findViewById(R.id.button_intensity_action);
    bIntensityAction.setOnClickListener(this);

    bPanTiltAction = (Button) actionButtons.findViewById(R.id.button_pantilt_action);
    bPanTiltAction.setOnClickListener(this);

    bGoboAction = (Button) actionButtons.findViewById(R.id.button_gobo_action);
    bGoboAction.setOnClickListener(this);

    bOpticAction = (Button) actionButtons.findViewById(R.id.button_optic_action);
    bOpticAction.setOnClickListener(this);

    bPrismAction = (Button) actionButtons.findViewById(R.id.button_prism_action);
    bPrismAction.setOnClickListener(this);
    //bOpticAction.setVisibility(View.INVISIBLE);
    //actionButtons.removeView(bOpticAction);

    bRawAction = (Button) actionButtons.findViewById(R.id.button_raw_action);
    bRawAction.setOnClickListener(this);
    //bRawAction.setVisibility(View.INVISIBLE);
    //actionButtons.removeView(bRawAction);

    bEffectAction = (Button) actionButtons.findViewById(R.id.button_effect_action);
    bEffectAction.setOnClickListener(this);
    //bEffectAction.setVisibility(View.INVISIBLE);
    //actionButtons.removeView(bEffectAction);

    bPresetAction = (Button) actionButtons.findViewById(R.id.button_preset_action);
    bPresetAction.setOnClickListener(this);

    bProgrammerAction = (Button) actionButtons.findViewById(R.id.button_programmer_action);
    bProgrammerAction.setOnClickListener(this);

    updateStateSelected();
    return actionButtons;
}

From source file:com.arantius.tivocommander.SeasonPass.java

public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
    final JsonNode sub = mSubscriptionData.get(position);
    final String subType = sub.path("idSetSource").path("type").asText();
    if ("wishListSource".equals(subType)) {
        return false;
    }//from  w w  w  .j  a va  2s  . com

    mLongClickPosition = position;

    final ArrayList<String> choices = new ArrayList<String>();
    choices.add(Explore.RecordActions.SP_MODIFY.toString());
    choices.add(Explore.RecordActions.SP_CANCEL.toString());
    final ArrayAdapter<String> choicesAdapter = new ArrayAdapter<String>(this,
            android.R.layout.select_dialog_item, choices);

    Builder dialogBuilder = new AlertDialog.Builder(this);
    dialogBuilder.setTitle("Operation?");
    dialogBuilder.setAdapter(choicesAdapter, this);
    AlertDialog dialog = dialogBuilder.create();
    dialog.show();

    return true;
}

From source file:com.bringcommunications.etherpay.SendActivity.java

private void do_help(int title, int msg) {
    android.support.v7.app.AlertDialog.Builder alertDialogBuilder = new android.support.v7.app.AlertDialog.Builder(
            context);//w w w.  j  a v a  2  s .  c o m
    alertDialogBuilder.setTitle(getResources().getString(title));
    alertDialogBuilder.setMessage(getResources().getString(msg));
    alertDialogBuilder.setCancelable(false);
    alertDialogBuilder.setNeutralButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
        }
    });
    android.support.v7.app.AlertDialog alertDialog = alertDialogBuilder.create();
    alertDialog.show();
}