Example usage for android.app AlertDialog.Builder setTitle

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

Introduction

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

Prototype

@Override
    public void setTitle(CharSequence title) 

Source Link

Usage

From source file:com.df.push.DemoActivity.java

private void displayOptionsToSubscribe() {
    final CharSequence[] cs = topics.toArray(new CharSequence[topics.size()]);
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Select topic to subscribe");

    builder.setItems(cs, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int item) {
            // Do something with the selection
            final SharedPreferences prefs = getGcmPreferences(context);
            subscribe(cs[item].toString(), prefs.getString(PROPERTY_REG_URL, null));
        }// www.  ja va 2 s  .co m
    });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:com.gmail.nagamatu.radiko.installer.RadikoInstallerActivity.java

private Dialog onCreateSelectAccountDialog() {
    final AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(R.string.select_account);
    final CharSequence[] items = new CharSequence[mAccounts.length];
    int i = 0;//from  w w w  .  j a  va  2 s.co  m
    for (Account a : mAccounts) {
        items[i++] = a.name;
    }
    builder.setItems(items, new OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            mAccount = mAccounts[which];
            showDialog(DIALOG_PASSWD);
        }
    });
    builder.setCancelable(false);
    return builder.create();
}

From source file:com.support.android.designlibdemo.activities.CampaignDetailActivity.java

public AlertDialog.Builder buildDialogNoPictures(Context c) {
    AlertDialog.Builder builder = new AlertDialog.Builder(c);
    builder.setTitle("There are no photos yet");
    builder.setMessage("Be first one and add more supportive pictures for this campaign");
    builder.setIcon(R.mipmap.ic_launcher_sou);
    builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
        @Override/* www . j  a  va2  s  . c o  m*/
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    return builder;
}

From source file:com.df.push.DemoActivity.java

private void displayOptionsToUnbscribe() {
    if (subscriptions.size() == 0) {
        Toast.makeText(getApplicationContext(), "No Subscriptions...", Toast.LENGTH_LONG).show();
        return;/*from  ww w. j a  va 2s .c  o m*/
    }
    final CharSequence[] cs = subscriptions.toArray(new CharSequence[subscriptions.size()]);
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Select item to unsubscribe");

    builder.setItems(cs, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int item) {
            // Do something with the selection
            unsubscribe(cs[item].toString());
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:edu.missouri.bas.activities.AdminManageActivity.java

private Dialog buildDialog1(Context context, String str) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setCancelable(false);//from  www. j av a 2  s. c o m
    builder.setTitle("Confirm");
    builder.setMessage(str);
    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            setHints();
        }
    });
    return builder.create();
}

From source file:org.deviceconnect.android.uiapp.DConnectActivity.java

@Override
protected void onResumeFragments() {
    super.onResumeFragments();

    // ?????????//  w ww.  ja va  2 s  .  c  om
    if (mError != null) {
        clearFragmentList();
        mLoadingFragment = new DialogFragment() {
            @Override
            public Dialog onCreateDialog(final Bundle savedInstanceState) {
                final AlertDialog.Builder builder = new AlertDialog.Builder(DConnectActivity.this);
                builder.setTitle(R.string.activity_failed_to_get_accesstoken);
                builder.setMessage(mError.toString());
                builder.setCancelable(true);
                mError = null;
                return builder.create();
            }
        };
        mLoadingFragment.show(getSupportFragmentManager(), "test");
    }
}

From source file:org.xbmc.android.remote.presentation.controller.AbstractController.java

public void onError(Exception exception) {
    if (mActivity == null) {
        return;//from   ww  w .  ja  v a 2  s  .c  o  m
    }
    final AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
    try {
        throw exception;
    } catch (NoSettingsException e) {
        builder.setTitle("No hosts detected");
        builder.setMessage(e.getMessage());
        builder.setNeutralButton("Settings", new OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                final Intent intent = new Intent(mActivity, HostSettingsActivity.class);
                //               intent.putExtra(SettingsActivity.JUMP_TO, SettingsActivity.JUMP_TO_INSTANCES);
                mActivity.startActivity(intent);
                mDialogShowing = false;
            }
        });
    } catch (NoNetworkException e) {
        builder.setTitle("No Network");
        builder.setMessage(e.getMessage());
        builder.setCancelable(true);
        builder.setNeutralButton("Settings", new OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                mActivity.startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));
                mDialogShowing = false;
            }
        });
    } catch (WrongDataFormatException e) {
        builder.setTitle("Internal Error");
        builder.setMessage(
                "Wrong data from HTTP API; expected '" + e.getExpected() + "', got '" + e.getReceived() + "'.");
    } catch (SocketTimeoutException e) {
        builder.setTitle("Socket Timeout");
        builder.setMessage("Make sure XBMC webserver is enabled and XBMC is running.");
        builder.setNeutralButton("Settings", new OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                mActivity.startActivity(new Intent(mActivity, SettingsActivity.class));
                mDialogShowing = false;
            }
        });
    } catch (ConnectException e) {
        builder.setTitle("Connection Refused");
        builder.setMessage("Make sure XBMC webserver is enabled and XBMC is running.");
        builder.setNeutralButton("Settings", new OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                mActivity.startActivity(new Intent(mActivity, SettingsActivity.class));
                mDialogShowing = false;
            }
        });
    } catch (IOException e) {
        if (e.getMessage() != null && e.getMessage().startsWith("Network unreachable")) {
            builder.setTitle("No network");
            builder.setMessage(
                    "XBMC Remote needs local network access. Please make sure that your wireless network is activated. You can click on the Settings button below to directly access your network settings.");
            builder.setNeutralButton("Settings", new OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    mActivity.startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));
                    mDialogShowing = false;
                }
            });
        } else {
            builder.setTitle("I/O Exception (" + e.getClass().getCanonicalName() + ")");
            if (e.getMessage() != null) {
                builder.setMessage(e.getMessage().toString());
            }
            Log.e(TAG, e.getStackTrace().toString());
        }
    } catch (HttpException e) {
        if (e.getMessage().startsWith("401")) {
            builder.setTitle("HTTP 401: Unauthorized");
            builder.setMessage(
                    "The supplied username and/or password is incorrect. Please check your settings.");
            builder.setNeutralButton("Settings", new OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    mActivity.startActivity(new Intent(mActivity, SettingsActivity.class));
                    mDialogShowing = false;
                }
            });
        }
    } catch (Exception e) {
        final String name = e.getClass().getName();
        builder.setTitle(name.substring(name.lastIndexOf(".") + 1));
        builder.setMessage(e.getMessage());
    } finally {

        exception.printStackTrace();
    }
    showDialog(builder);
}

From source file:it.sasabz.android.sasabus.InfoActivity.java

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setPositiveButton(android.R.string.ok, new Dialog.OnClickListener() {

        @Override/*from   w w w  . j av  a2s . c  om*/
        public void onClick(DialogInterface dialogInterface, int i) {
            dialogInterface.dismiss();
        }
    });
    Information information = (Information) list.get(position);
    builder.setTitle(Html.fromHtml(information.getTitel()));
    builder.setMessage(Html.fromHtml("<pre>" + information.getNachricht() + "</pre>"));
    builder.create().show();
}

From source file:com.spoiledmilk.cykelsuperstier.break_rote.BreakRouteActivity.java

private void showRouteNoBreakDialog() {
    if (dialog == null) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(CykelsuperstierApplication.getString("no_route"));
        builder.setMessage(CykelsuperstierApplication.getString("cannot_broken"));
        builder.setPositiveButton("OK", new OnClickListener() {
            @Override/* ww  w.  j a  v a  2  s  .  com*/
            public void onClick(DialogInterface dialog, int arg1) {
                dialog.dismiss();
                finish();
                overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right);
            }
        });
        dialog = builder.create();
        dialog.setCancelable(false);
    }
    dialog.show();
}

From source file:com.cricketkorner.cricket.VitamioListActivity.java

@Override
public void onBackPressed() {

    AlertDialog.Builder alert = new AlertDialog.Builder(VitamioListActivity.this);

    alert.setTitle("Please Rate This App.");
    alert.setMessage("We highly appreciate you to rate us.");

    alert.setPositiveButton("I will Rate. :-)", new DialogInterface.OnClickListener() {
        @Override//from ww  w . j a va2  s.c  o  m
        public void onClick(DialogInterface dialog, int whichButton) {
            String url = "https://play.google.com/store/apps/details?id=com.cricketkorner.cricket";
            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(url));
            startActivity(i);
        }
    });

    alert.setNegativeButton("No Thanks :-(", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int whichButton) {
            finish();

        }
    });
    alert.show();
}