Example usage for android.app AlertDialog.Builder show

List of usage examples for android.app AlertDialog.Builder show

Introduction

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

Prototype

public void show() 

Source Link

Document

Start the dialog and display it on screen.

Usage

From source file:net.evecom.android.web.Web3Activity.java

/**
 * /*from   ww w . j  av  a 2s.  c  o m*/
 * 
 * @param v
 */
public void message_post_web_tomain(View v) {
    AlertDialog.Builder builder1 = new AlertDialog.Builder(Web3Activity.this);
    builder1.setTitle("");
    builder1.setIcon(R.drawable.qq_dialog_default_icon);// 
    builder1.setMessage("");
    builder1.setPositiveButton("", new DialogInterface.OnClickListener() {
        // @Override
        public void onClick(DialogInterface dialog, int which) {
            finish();
        }
    });
    builder1.setNegativeButton("", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {

        }
    });
    builder1.show();
}

From source file:edu.cmu.cs.cloudlet.android.CloudletActivity.java

private void showDialogSelectOverlay(final ArrayList<VMInfo> vmList) {
    String[] nameList = new String[vmList.size()];
    for (int i = 0; i < nameList.length; i++) {
        nameList[i] = new String(vmList.get(i).getAppName());
    }/*from   w  ww . j a v a 2s  .  co m*/

    AlertDialog.Builder ab = new AlertDialog.Builder(this);
    ab.setTitle("Overlay List");
    ab.setIcon(R.drawable.ic_launcher);
    ab.setSingleChoiceItems(nameList, 0, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int position) {
            selectedOveralyIndex = position;
        }
    }).setPositiveButton("Ok", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int position) {
            if (position >= 0) {
                selectedOveralyIndex = position;
            }
            VMInfo overlayVM = vmList.get(selectedOveralyIndex);
            runConnection(CLOUDLET_SYNTHESIS_IP, CLOUDLET_SYNTHESIS_PORT, overlayVM);
        }
    }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int position) {
            return;
        }
    });
    ab.show();
}

From source file:net.evecom.androidecssp.base.BaseActivity.java

/**
 * /*w w  w  .ja  v a  2  s .  c  o m*/
 * 
 * @param errorMsg
 */
protected void dialogPickToast(String title, String msg, String ymsg, String nmsg,
        final IPickCallback callback) {
    AlertDialog.Builder builder1 = new AlertDialog.Builder(this);
    builder1.setTitle(title);
    builder1.setIcon(R.drawable.qq_dialog_default_icon);// 
    builder1.setMessage(msg);
    builder1.setPositiveButton(ymsg, new DialogInterface.OnClickListener() {
        // @Override
        public void onClick(DialogInterface dialog, int which) {
            if (null != callback) {
                callback.yes();
            }
        }
    });
    builder1.setNegativeButton(nmsg, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            callback.no();
        }
    });
    builder1.show();
}

From source file:net.evecom.android.web.Web2Activity.java

/**
 * // w w  w  .  j av  a  2  s. c o m
 * 
 * @param v
 */
public void message_post_web_tomain(View v) {
    AlertDialog.Builder builder1 = new AlertDialog.Builder(Web2Activity.this);
    builder1.setTitle("");
    builder1.setIcon(R.drawable.qq_dialog_default_icon);// 
    builder1.setMessage("");
    builder1.setPositiveButton("", new DialogInterface.OnClickListener() {
        // @Override
        public void onClick(DialogInterface dialog, int which) {
            finish();
        }
    });
    builder1.setNegativeButton("", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {

        }
    });
    builder1.show();
}

From source file:com.todoroo.astrid.taskrabbit.TaskRabbitActivity.java

public void showIntroDialog() {
    if (!Preferences.getBoolean(TASK_RABBIT_DIALOG_INTRO_PREF, false)) {
        if (TaskRabbitLocationManager.supportsCurrentLocation(currentLocation)) {

            AlertDialog.Builder adb = new AlertDialog.Builder(TaskRabbitActivity.this);
            adb.setTitle(R.string.tr_alert_intro_title);
            adb.setMessage(getString(R.string.tr_alert_intro_location));
            adb.setPositiveButton(getString(R.string.tr_alert_button_close),
                    new DialogInterface.OnClickListener() {
                        public void onClick(final DialogInterface dialog, final int id) {
                            showAddListPopover();
                        }//from w  ww.j a  v a 2  s .  c  om
                    });
            adb.show();
        } else {
            final AlertDialog adb = new AlertDialog.Builder(TaskRabbitActivity.this)
                    .setTitle(R.string.tr_alert_intro_title).setMessage(R.string.tr_alert_intro_no_location)
                    .setPositiveButton(getString(R.string.tr_alert_button_close), null).show();

            ((TextView) adb.findViewById(android.R.id.message))
                    .setMovementMethod(LinkMovementMethod.getInstance());
        }
        Preferences.setBoolean(TASK_RABBIT_DIALOG_INTRO_PREF, true);
    }
}

From source file:fr.pasteque.client.Configure.java

@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    if (preference.getKey().equals("printer_driver")) {
        // On printer driver update, change models
        if (newValue.equals("EPSON ePOS") && !Compat.isEpsonPrinterCompatible()) {
            Toast t = Toast.makeText(this, R.string.not_compatible, Toast.LENGTH_SHORT);
            t.show();//from w ww  . j  a v a  2 s .co  m
            return false;
        } else if ((newValue.equals("LK-PXX") && !Compat.isLKPXXPrinterCompatible())
                || (newValue.equals("Woosim") && !Compat.isWoosimPrinterCompatible())) {
            Toast t = Toast.makeText(this, R.string.not_compatible, Toast.LENGTH_SHORT);
            t.show();
            return false;
        }
        this.updatePrinterPrefs(newValue);
    } else if ("card_processor".equals(preference.getKey())) {
        if ("payleven".equals(newValue) && !Compat.hasPaylevenApp(this)) {
            // Trying to enable payleven without app: download
            AlertDialog.Builder b = new AlertDialog.Builder(this);
            b.setTitle(R.string.config_payleven_download_title);
            b.setMessage(R.string.config_payleven_download_message);
            b.setIcon(android.R.drawable.ic_dialog_info);
            b.setNegativeButton(android.R.string.cancel, null);
            b.setPositiveButton(R.string.config_payleven_download_ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    Intent i = new Intent(Intent.ACTION_VIEW,
                            Uri.parse("market://details?id=de.payleven.androidphone"));
                    Configure.this.startActivity(i);
                }
            });
            b.show();
            return false;
        }
        this.updateCardProcessorPreferences((String) newValue);
    }
    return true;
}

From source file:no.ntnu.idi.socialhitchhiking.map.MapActivityJourney.java

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    pickupPoint = getApp().getJourneyPickupPoint();
    dropoffPoint = getApp().getJourneyDropoffPoint();

    TextView driverView = (TextView) findViewById(R.id.mapViewJourneyDriver);
    TextView leaveTxt = (TextView) findViewById(R.id.leaveRideText);

    if (getApp().getUser().getFullName().equals(getApp().getSelectedJourney().getDriver().getFullName())) {
        leaveTxt.setText("Cancel ride");
    } else {//  w  w  w . j av a 2 s . c o  m
        leaveTxt.setText("Leave ride");
    }

    if (pickupPoint != null) {
        drawCross(pickupPoint, true);
    }
    if (dropoffPoint != null) {
        drawCross(dropoffPoint, false);
    }
    driverView.setText(getApp().getSelectedJourney().getDriver().getFullName());

    if (getApp().getSelectedJourney().getHitchhikers().size() != 0) {

        TextView firstHitchTxt = (TextView) findViewById(R.id.firstHikerTxt);

        firstHitchTxt.setText(getApp().getSelectedJourney().getHitchhikers().get(0).getFullName());

        if (getApp().getSelectedJourney().getHitchhikers().size() > 1) {
            for (int c = 1; c < getApp().getSelectedJourney().getHitchhikers().size(); c++) {
                HitchList hitch = new HitchList(getApp().getSelectedJourney().getHitchhikers().get(c));
            }
        }

    } else {
        TextView firstHitchTxt = (TextView) findViewById(R.id.firstHikerTxt);
        firstHitchTxt.setText("No hitchhikers");
    }

    leaveRide = (FrameLayout) findViewById(R.id.leaveRide);
    leaveRide.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            AlertDialog.Builder ad = new AlertDialog.Builder(MapActivityJourney.this);
            if (getApp().getUser().getFullName()
                    .equals(getApp().getSelectedJourney().getDriver().getFullName())) {
                ad.setMessage("Do you want to cancel this ride?");
            } else {
                ad.setMessage("Do you want to leave this ride?");
            }
            ad.setTitle("Confirm");

            ad.setNegativeButton("Ok", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    handleJourney(getApp().getSelectedJourney());
                    MapActivityJourney.this.finish();
                }
            });
            ad.setPositiveButton("Cancel", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {

                }
            });
            ad.show();

        }

    });

    btn = (FrameLayout) findViewById(R.id.mapViewJourneyBtn);
    btn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            sendMessageToDriver();
        }

    });

}

From source file:com.example.android.cardreader.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.alternate_main_fragment);

    //TODO Stop Executing Eden
    //Globals.executeEden();
    getUsers(1);//from  w ww.j a  v  a 2s .  co  m

    instance = this;
    final ActionBar actionBar = getActionBar();
    actionBar.setTitle("           TartanHacks");
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg));
    actionBar.setStackedBackgroundDrawable(getResources().getDrawable(R.drawable.tab_bg));
    actionBar.setDisplayShowHomeEnabled(true);

    frags.add(new PersonListFrag(Globals.pending));
    frags.add(new PersonListFrag(Globals.allUsers));
    frags.add(new PersonListFrag(Globals.checkedIn));

    mAdapter = new FragmentAdapter(getFragmentManager());

    fab = findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            View dialogView = View.inflate(instance, R.layout.dialog_signup, null);

            idField = (EditText) dialogView.findViewById(R.id.andrewIdField);
            pb = (ProgressBar) dialogView.findViewById(R.id.progress);
            nameField = (TextView) dialogView.findViewById(R.id.name);
            scanView = (TextView) dialogView.findViewById(R.id.scan_view);

            idField.addTextChangedListener(new TextWatcher() {
                @Override
                public void beforeTextChanged(CharSequence s, int start, int count, int after) {

                }

                @Override
                public void onTextChanged(CharSequence s, int start, int before, int count) {
                    String id = s.toString();
                    pb.setVisibility(View.VISIBLE);
                    queryId(id);

                }

                @Override
                public void afterTextChanged(Editable s) {

                }
            });

            AlertDialog.Builder builder;
            builder = new AlertDialog.Builder(instance);
            builder.setView(dialogView);
            builder.setCancelable(true);
            builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialog) {
                    Globals.adding = false;
                }
            });

            signupDialog = builder.show();
        }
    });

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setOffscreenPageLimit(0);
    mViewPager.setAdapter(mAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            // When swiping between different app sections, select the corresponding tab.
            // We can also use ActionBar.Tab#select() to do this if we have a reference to the
            // Tab.
            actionBar.setSelectedNavigationItem(position);
        }
    });

    actionBar.addTab(actionBar.newTab().setText("Pending").setTabListener(this));
    actionBar.addTab(actionBar.newTab().setText("All").setTabListener(this));
    actionBar.addTab(actionBar.newTab().setText("Checked In").setTabListener(this));

    mLoyaltyCardReader = new LoyaltyCardReader(this);

    // Disable Android Beam and register our card reader callback
    enableReaderMode();

    new UpdateThread().executeOnExecutor(Executors.newSingleThreadExecutor());
}

From source file:com.sweetiepiggy.raspberrybusmalaysia.SubmitTripActivity.java

private void submit() {
    final String sched_time = format_time(mData.sched_time);
    final String depart_time = format_time(mData.depart_time);
    final String arrival_time = format_time(mData.arrival_time);
    final String agent = ((AutoCompleteTextView) findViewById(R.id.agent_entry)).getText().toString();
    final String operator = ((AutoCompleteTextView) findViewById(R.id.operator_entry)).getText().toString();
    final String from_station = ((AutoCompleteTextView) findViewById(R.id.from_station_entry)).getText()
            .toString();//from  w w w . j  a va  2s .  c o m
    final String to_station = ((AutoCompleteTextView) findViewById(R.id.to_station_entry)).getText().toString();
    final String safety = Integer.toString((int) ((RatingBar) findViewById(R.id.safety_bar)).getRating());
    final String comfort = Integer.toString((int) ((RatingBar) findViewById(R.id.comfort_bar)).getRating());
    final String overall = Integer.toString((int) ((RatingBar) findViewById(R.id.overall_bar)).getRating());
    final String comment = ((EditText) findViewById(R.id.comment_entry)).getText().toString();

    String disp_sched = DateFormat.getTimeFormat(getApplicationContext()).format(mData.sched_time.getTime());
    String trip_time = format_time(
            (mData.arrival_time.getTimeInMillis() - mData.sched_time.getTimeInMillis()) / 1000);
    String delay = format_time_min(
            (mData.depart_time.getTimeInMillis() - mData.sched_time.getTimeInMillis()) / 1000);
    String info = getResources().getString(R.string.sched_time) + ": " + disp_sched + "\n"
            + getResources().getString(R.string.trip_time) + ": " + trip_time + "\n"
            + getResources().getString(R.string.delay) + ": " + delay;

    AlertDialog.Builder alert = new AlertDialog.Builder(this);
    alert.setTitle(R.string.confirm_submit);
    alert.setMessage(info);
    alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            String msg = format_email(agent, operator, from_station, to_station, sched_time, depart_time,
                    arrival_time, safety, comfort, overall, comment);

            new PostTask(getApplicationContext(), msg).execute();
        }
    });
    alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    alert.show();
}

From source file:gr.scify.newsum.ui.ViewActivity.java

protected void showHelpDialog() {
    SharedPreferences setvmassage = getSharedPreferences("dialog", 0);
    boolean dialogShown = setvmassage.getBoolean("dialogShown", false);

    if (!dialogShown) {
        // prepare the alert box
        AlertDialog.Builder alertbox = new AlertDialog.Builder(this);
        alertbox.setMessage(R.string.view_massage);
        alertbox.setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {
            }//from   w  w  w  .  j  a  v  a  2  s  .  c o m
        });
        alertbox.setCancelable(false);
        alertbox.show();

        SharedPreferences.Editor editor = setvmassage.edit();
        editor.putBoolean("dialogShown", true);
        editor.commit();
    }

}