Example usage for android.app AlertDialog setMessage

List of usage examples for android.app AlertDialog setMessage

Introduction

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

Prototype

public void setMessage(CharSequence message) 

Source Link

Usage

From source file:com.abcvoipsip.ui.calllog.CallLogListFragment.java

private void deleteAllCalls() {
    AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create();
    alertDialog.setTitle(R.string.callLog_delDialog_title);
    alertDialog.setMessage(getString(R.string.callLog_delDialog_message));
    alertDialog.setButton(getString(R.string.callLog_delDialog_yes), new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            getActivity().getContentResolver().delete(SipManager.CALLLOG_URI, null, null);
        }// w  ww  .j  a  v a  2  s  .c  o m
    });
    alertDialog.setButton2(getString(R.string.callLog_delDialog_no), (DialogInterface.OnClickListener) null);
    try {
        alertDialog.show();
    } catch (Exception e) {
        Log.e(THIS_FILE, "error while trying to show deletion yes/no dialog");
    }
}

From source file:in.fabinpaul.sixthsense.SixthSenseActivity.java

@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
    switch (requestCode) {
    case REQUEST_CAMERA_PERMISSION: {
        if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

            OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);

        } else {//from   www.  ja v a2  s .  c om

            AlertDialog ad = new AlertDialog.Builder(this).create();
            ad.setCancelable(false); // This blocks the 'BACK' button
            ad.setMessage(
                    "It seems that you device does not support camera (or it is locked). Application will be closed.");
            ad.setButton(DialogInterface.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    finish();
                }
            });
            ad.show();
        }
        return;
    }

    // other 'case' lines to check for other
    // permissions this app might request
    }
}

From source file:com.clearcenter.mobile_demo.mdMainActivity.java

public void onCreate(Bundle bundle) {
    Log.i(TAG, "onCreate(" + bundle + ")");
    super.onCreate(bundle);

    setContentView(R.layout.main_activity);

    Log.i(TAG, "loading data from Intent");
    final Intent intent = getIntent();
    Log.i(TAG, "onCreate intent: " + intent);
    final Bundle extras = getIntent().getExtras();
    Log.i(TAG, "onCreate intent extras: " + extras);

    accounts_textview = (TextView) findViewById(R.id.accounts_textview);
    accounts_listview = (ListView) findViewById(R.id.accounts_listview);
    accounts_adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1);
    accounts_listview.setAdapter(accounts_adapter);
    accounts_listview.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position == 0) {
                final Intent intent = new Intent(mdMainActivity.this, mdAuthenticatorActivity.class);
                mdMainActivity.this.startActivity(intent);
                //new Intent(android.provider.Settings.ACTION_ADD_ACCOUNT), 0);
            } else {
                final Intent intent = new Intent(mdMainActivity.this, mdStatusActivity.class);
                intent.putExtra("nickname", mdMainActivity.this.accounts_adapter.getItem(position));
                mdMainActivity.this.startActivity(intent);
            }//  w  w w  .  ja v a 2  s  . c o  m
        }
    });

    accounts_listview.setOnItemLongClickListener(new OnItemLongClickListener() {
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            if (position == 0)
                return false;
            final String nickname = mdMainActivity.this.accounts_adapter.getItem(position);
            mdMainActivity.this.account_to_delete = nickname;
            AlertDialog alert_dialog = new AlertDialog.Builder(mdMainActivity.this).create();
            //alert_dialog.setIcon(R.drawable.ic_launcher);
            alert_dialog.setTitle("Remove System?");
            alert_dialog.setMessage("Are you sure you want to remove the " + nickname + " system account?");
            alert_dialog.setButton(DialogInterface.BUTTON_POSITIVE, "Remove system",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            mdMainActivity.this.onRemoveAccount();
                        }
                    });
            alert_dialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                        }
                    });

            alert_dialog.show();
            return true;
        }
    });

    account_manager = AccountManager.get(this);
}

From source file:bikebadger.RideActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    Log.d("Bike Badger", "RideActivity::onCreate");
    super.onCreate(savedInstanceState);

    Context context = getApplicationContext();
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    AppManager.AppStartEnum startMode = AppManager.CheckAppStart(getApplicationContext(), preferences);
    //startMode = AppManager.AppStartEnum.EXPIRED_FREE;
    //startMode = AppManager.AppStartEnum.DISABLED;
    switch (startMode) {
    case DISABLED:
        AlertDialog finishAlert = new AlertDialog.Builder(this).create();
        finishAlert.setCancelable(false);
        finishAlert.setTitle("Trial Expired");
        finishAlert.setMessage("Your trial has expired. Please consider purchasing the full version.");
        finishAlert.setButton("Ok", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                //RideManager rm = RideManager.get(RideActivity.this);
                //if(rm != null)
                //  rm.Shutdown();
                RideActivity.this.finish();
                //dialog.dismiss();
            }//w  ww  . ja v a  2  s.co m
        });
        finishAlert.show();
        break;
    case EXPIRED_FREE: // expired trail. Let them purchase or do nothing.
        AppManager.PurchaseDialog(this);
        break;
    case NORMAL_FREE:
        // Still counting down the expiry. Do nothing
        break;
    case NORMAL_PAID:
        // TODO Until I figure out what this overly complicated thing does, don't use it
        // If it is merely to prevent folks from side-loading a copy they somehow get a hold of, they
        // deserve a free version
        //  checkLicense();
        // all is well. Do nothing
        break;
    case FIRST_TIME_FREE:
        // the version number ends in .free
        AppManager.CopyAssetFileOrDir("empty.gpx", context);
        AppManager.CopyAssetFileOrDir("EnchiladaBuffet_Austin.gpx", context);
        AppManager.CopyAssetFileOrDir("BikeBadger.pdf", context);

        // conditional shows the version notes (only if the version has changed)
        VersionNotes myNotes = new VersionNotes(this);
        myNotes.showVersionNotes();
        break;
    case FIRST_TIME_PAID:
        AppManager.CopyAssetFileOrDir("empty.gpx", context);
        AppManager.CopyAssetFileOrDir("EnchiladaBuffet_Austin.gpx", context);
        AppManager.CopyAssetFileOrDir("BikeBadger.pdf", context);

        // TODO Until I figure out what this overly complicated thing does, don't use it
        // If it is merely to prevent folks from side-loading a copy they somehow get a hold of, they
        // deserve a free version
        // checkLicense();

        // conditional shows the version notes (only if the version has changed)
        VersionNotes myNotes2 = new VersionNotes(this);
        myNotes2.showVersionNotes();

        break;
    case FIRST_TIME_VERSION:
        AppManager.CopyAssetFileOrDir("BikeBadger.pdf", context);
        // conditional shows the version notes (only if the version has changed)
        VersionNotes myNotes1 = new VersionNotes(this);
        myNotes1.showVersionNotes();
        break;
    }

    if (AppManager.IsPackageInstalled("net.dinglisch.android.taskerm", context)) {
        Log.d(Constants.APP.TAG, "Tasker Installed");
    }

    if (AppManager.IsPackageInstalled("com.strava", context)) {
        Log.d(Constants.APP.TAG, "Strava Installed");
    } else {
        Intent intent = new Intent(Intent.ACTION_VIEW,
                Uri.parse("market://details?id=com.google.android.apps.maps"));
        startActivity(intent);
    }

    if (AppManager.IsPackageInstalled("com.maxmpz.audioplayer", context)) {
        Log.d(Constants.APP.TAG, "PowerAMP Installed");
    }

}

From source file:com.example.ramap.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    switch (item.getItemId()) {
    //TODO: Open HistoryActivity.java with ListView Array of SharedPreferences values.
    case R.id.check_in_history_menu:
        SharedPreferences loadHistory = getSharedPreferences(SAVE, MODE_PRIVATE);
        currentLocation = loadHistory.getString("name", "You're not checked in!");
        //currentLocation.setText(String.valueOf(notCheckedIn));
        loadHistory.getString(SAVE, "");
        Toast.makeText(getApplicationContext(), ("Previous check in loaded successfully!\n" + currentLocation),
                Toast.LENGTH_SHORT).show();

        //Intent intent = new Intent (getApplicationContext(), HistoryActivity.class);
        //startActivity(intent); // starts
        break;/*from w  ww.  j av a 2s .  co m*/

    //TODO: This should open a SettingsActivity.java to change settings on the application.
    //case R.id.settings_menu:
    //    Toast.makeText(getBaseContext(), "Settings option doesn't work yet.", Toast.LENGTH_SHORT).show();
    //    break;

    case R.id.about_menu:
        AlertDialog alertDialog = new AlertDialog.Builder(this).create();
        alertDialog.setTitle("About RaMap");
        alertDialog.setMessage("Developed for CISC 4400 by:\n" + "Joseph LeRoy\n" + "Kevin McCarthy\n"
                + "Alexander Despotakis\n" + "Fizan Imtiaz");
        alertDialog.show();

        //Toast.makeText(getBaseContext(), "Created by: Joseph LeRoy, Kevin McCarthy, Alexander Despotakis, Fizan Imtiaz", Toast.LENGTH_SHORT).show();
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.prof.rssparser.example.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    int id = item.getItemId();

    if (id == R.id.action_settings) {
        android.support.v7.app.AlertDialog alertDialog = new android.support.v7.app.AlertDialog.Builder(
                MainActivity.this).create();
        alertDialog.setTitle(R.string.app_name);
        alertDialog.setMessage(Html.fromHtml(MainActivity.this.getString(R.string.info_text)
                + " <a href='http://github.com/prof18/RSS-Parser'>GitHub.</a>"
                + MainActivity.this.getString(R.string.author)));
        alertDialog.setButton(android.support.v7.app.AlertDialog.BUTTON_NEUTRAL, "OK",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }/*w  w  w  .j  a v  a  2s . c o  m*/
                });
        alertDialog.show();

        ((TextView) alertDialog.findViewById(android.R.id.message))
                .setMovementMethod(LinkMovementMethod.getInstance());
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.example.yudiandrean.socioblood.ChangePassword.java

/**
 * Called when the activity is first created.
 *///from   ww w  . jav a 2  s. com
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.changepassword);

    cancel = (Button) findViewById(R.id.btcancel);
    cancel.setOnClickListener(new View.OnClickListener() {
        public void onClick(View arg0) {

            Intent login = new Intent(getApplicationContext(), LoginActivity.class);

            startActivity(login);
            finish();
        }

    });

    newpass = (EditText) findViewById(R.id.newpass);
    verifynewpass = (EditText) findViewById(R.id.verifynewpass);
    alert = (TextView) findViewById(R.id.alertpass);
    changepass = (Button) findViewById(R.id.btchangepass);

    changepass.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            if (newpass.getText().toString().equals("")) {
                AlertDialog alertDialog = new AlertDialog.Builder(ChangePassword.this).create();
                alertDialog.setTitle("Error");
                alertDialog.setMessage("Password field is empty");
                alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        //dismiss the dialog
                    }
                });
                alertDialog.show();
            } else if (!verifynewpass.getText().toString().equals(newpass.getText().toString())) {
                AlertDialog alertDialog = new AlertDialog.Builder(ChangePassword.this).create();
                alertDialog.setTitle("Error");
                alertDialog.setMessage("Passwords do not match, try again!");
                alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        //dismiss the dialog
                    }
                });
                alertDialog.show();
            } else {
                NetAsync(view);
            }
        }
    });
}

From source file:com.telestax.restcomm_olympus.MainFragment.java

private void showOkAlert(final String title, final String detail) {
    AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create();
    alertDialog.setTitle(title);/*from  ww  w.  j  av  a2s .  co  m*/
    alertDialog.setMessage(detail);
    alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    alertDialog.show();
}

From source file:com.aikidonord.fragments.FragmentDate.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View view = inflater.inflate(R.layout.fragment_date, null /*container, false*/);

    View rlLoading = view.findViewById(R.id.loadingPanel);
    //View listView = view.getListView();

    if (VerifConnexion.isOnline(this.getActivity())) {
        rlLoading.setVisibility(View.VISIBLE);

        // on va fair l'impasse l dessus vu que je ne suis pas bien sr
        // de la manire dont il faut oprer tant que la vue n'a pas t renvoye.
        //listView.setVisibility(View.GONE);
        this.lancementAsync();
    } else {// ww w  .  j  av a2s . co  m

        AlertDialog alertDialog = new AlertDialog.Builder(this.getActivity()).create();
        alertDialog.setTitle(getResources().getString(R.string.app_name));
        alertDialog.setMessage(getResources().getString(R.string.no_network));
        alertDialog.setIcon(R.drawable.ic_launcher);
        alertDialog.setCancelable(false);
        alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, getResources().getString(R.string.close),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        // if this button is clicked, close
                        // current activity
                        FragmentDate.this.getActivity().finish();
                    }
                });
        alertDialog.show();
    }

    return view;
}

From source file:com.aikidonord.fragments.FragmentLieu.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View view = inflater.inflate(R.layout.fragment_lieu, null /*container, false*/);

    View rlLoading = view.findViewById(R.id.loadingPanel);
    //View listView = view.getListView();

    if (VerifConnexion.isOnline(this.getActivity())) {
        rlLoading.setVisibility(View.VISIBLE);

        // on va fair l'impasse l dessus vu que je ne suis pas bien sr
        // de la manire dont il faut oprer tant que la vue n'a pas t renvoye.
        //listView.setVisibility(View.GONE);
        this.lancementAsync();
    } else {//from  ww  w. j  av  a 2 s  . c  o  m

        AlertDialog alertDialog = new AlertDialog.Builder(this.getActivity()).create();
        alertDialog.setTitle(getResources().getString(R.string.app_name));
        alertDialog.setMessage(getResources().getString(R.string.no_network));
        alertDialog.setIcon(R.drawable.ic_launcher);
        alertDialog.setCancelable(false);
        alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, getResources().getString(R.string.close),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        // if this button is clicked, close
                        // current activity
                        FragmentLieu.this.getActivity().finish();
                    }
                });
        alertDialog.show();
    }

    return view;
}