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:au.id.micolous.frogjump.Util.java

private static void newVersionAlert(final Activity activity) {
    // We have a new version available.  Prompt.
    AlertDialog.Builder updateDialog = new AlertDialog.Builder(activity);
    updateDialog.setTitle(R.string.update_available_title);
    updateDialog.setMessage(R.string.update_available_message);
    updateDialog.setPositiveButton(R.string.update_positive, new DialogInterface.OnClickListener() {
        @Override//from   w ww.j av  a2s  .co m
        public void onClick(DialogInterface dialogInterface, int i) {
            try {
                activity.startActivity(
                        new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName())));
            } catch (ActivityNotFoundException anfe) {
                // Hmm, market is not installed
                Log.w(TAG, "Google Play is not installed; cannot install update");
            }
        }
    });
    updateDialog.setNegativeButton(R.string.update_negative, null);
    updateDialog.setCancelable(true);
    updateDialog.show();

}

From source file:com.sorin.mediync.volley.PatientListView.java

private void showErrorDialog() {
    mInError = true;//from w  ww .  j a  va  2  s  .  c  om

    AlertDialog.Builder b = new AlertDialog.Builder(PatientListView.this);
    b.setMessage("Error occured");
    b.show();
}

From source file:com.github.irib_examples.Act_NetworkListView.java

private void showErrorDialog() {
    mInError = true;//ww w  .  jav a  2  s  . c o m

    AlertDialog.Builder b = new AlertDialog.Builder(Act_NetworkListView.this);
    b.setMessage("Error occured");
    b.show();
}

From source file:com.volley.demo.ExampleNetworkListView.java

private void showErrorDialog() {
    mInError = true;//w ww  .j av  a2  s .co m

    AlertDialog.Builder b = new AlertDialog.Builder(ExampleNetworkListView.this);
    b.setMessage("Error occured");
    b.show();
}

From source file:br.com.split.activities.FacebookEscolherLocalActivity.java

private void onError(Exception exception) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Error").setMessage(exception.getMessage()).setPositiveButton("OK", null);
    builder.show();
}

From source file:com.javierc.albuquerquenow.SearchMap.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    if (item.getItemId() == android.R.id.home) {
        this.finish();
    } else if (item.getItemId() == R.id.action_legalnotices) {
        String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext());
        AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(SearchMap.this);
        LicenseDialog.setTitle("Legal Notices");
        LicenseDialog.setMessage(LicenseInfo);
        LicenseDialog.show();

    }/*from  www . j av  a 2s  . c om*/
    return super.onOptionsItemSelected(item);
}

From source file:mp.paschalis.App.java

/**
 * Finds out if network connection is available
 *//*from   w ww. j  a v a  2s .c  o m*/
public static void isNetworkAvailable(final Context ctx) {
    ConnectivityManager connectivityManager = (ConnectivityManager) ctx
            .getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();

    if (activeNetworkInfo == null) {
        {
            AlertDialog.Builder alert = new AlertDialog.Builder(ctx);
            alert.setTitle(R.string.msgNoInternetConnectionTitle);
            alert.setMessage(R.string.msgNoInternetConnection);
            alert.setIcon(android.R.drawable.ic_dialog_alert);

            alert.setNeutralButton(R.string.no, new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int whichButton) {

                }
            });

            alert.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int whichButton) {
                    ctx.startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));
                }
            });

            alert.show();
        }
    }

}

From source file:com.fuzz.android.limelight.model.ChapterTransition.java

public static void getDrawerPosition() {
    LayoutInflater inflater = LimeLight.getActivity().getLayoutInflater();
    View drawerView = inflater.inflate(R.layout.choose_drawer_item, null);

    AlertDialog.Builder builder = new AlertDialog.Builder(LimeLight.getActivity());
    builder.setTitle(R.string.choose_drawer_item);
    builder.setView(drawerView);//from w w  w  . ja  va2s  .co  m

    final Spinner positionSpinner = (Spinner) drawerView.findViewById(R.id.positionSpinner);

    ArrayList<String> items = new ArrayList<String>();
    for (int i = 0; i < LimeLight.getDrawerList().getAdapter().getCount(); i++) {
        items.add(i + "");
    }

    ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(LimeLight.getActivity(),
            android.R.layout.simple_spinner_dropdown_item, items);

    positionSpinner.setAdapter(spinnerArrayAdapter);

    positionSpinner.setSelection(mDrawerItemPosition);

    builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            mDrawerItemPosition = Integer.valueOf(positionSpinner.getSelectedItem().toString());
        }
    });

    builder.setNegativeButton(R.string.cancel, null);

    builder.create();
    builder.show();
}

From source file:ar.uba.fi.mileem.SimpleFormActivity.java

public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_legalnotices:
        String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext());
        AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(SimpleFormActivity.this);
        LicenseDialog.setTitle("Legal Notices");
        LicenseDialog.setMessage(LicenseInfo);
        LicenseDialog.show();
        return true;
    }/*ww  w  . j a v  a2 s.  co m*/
    return super.onOptionsItemSelected(item);
}