Example usage for android.app AlertDialog.Builder setMessage

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

Introduction

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

Prototype

public void setMessage(CharSequence message) 

Source Link

Usage

From source file:com.example.okano.simpleroutesearch.MapsActivity.java

public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case MENU_A://from  w  ww. j  a  v  a2s  .  c  o m
        showMapInfo();
        //show_mapInfo();
        return true;

    case MENU_B:
        //Legal Notices(?)

        String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext());
        AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(MapsActivity.this);
        LicenseDialog.setTitle("Legal Notices");
        LicenseDialog.setMessage(LicenseInfo);
        LicenseDialog.show();

        return true;

    case MENU_c:
        //show_settings();
        return true;

    }
    return false;
}

From source file:es.rczone.tutoriales.gmaps.MainActivity.java

private void showLegalNotice() {
    String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(this);
    AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(this);
    LicenseDialog.setTitle("Legal Notices");
    LicenseDialog.setMessage(LicenseInfo);
    LicenseDialog.show();//from  w  w  w .  j  av  a 2s .co m
}

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);/*ww  w.j  a  v a 2 s . co  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:csic.ceab.movelab.beepath.MainActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    AlertDialog.Builder builder = null;
    switch (id) {
    case EXIT_DIALOG:
        builder = new AlertDialog.Builder(this);
        builder.setMessage("Do you want to exit?").setCancelable(true).setPositiveButton("Yes",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        stop();//from   w  w  w .java2  s . c om
                    }
                });
        alert = builder.create();
        break;
    }
    return alert;
}

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/*from   ww w .  j  a  v a 2 s. com*/
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    return builder;
}

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

private Dialog buildDialog2(Context context, String str) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setCancelable(false);/*from  w ww.  ja  v  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) {
            editor.putString(ASID, asID.getText().toString());
            Log.d("here!!!", "id is " + asID.getText().toString());
            //format check

            editor.putString(ASPWD, "");
            editor.commit();
            setHints();
            setResult(8);
        }
    });
    builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            // TODO Auto-generated method stub
            setHints();
        }
    });
    return builder.create();
}

From source file:edu.stanford.mobisocial.dungbeetle.ui.wizard.ChangePictureActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_feed_home);

    checked = new boolean[filterTypes.length];

    for (int x = 0; x < filterTypes.length; x++) {
        checked[x] = true;/*from w  ww .  ja  va 2s .c om*/
    }

    findViewById(R.id.btn_broadcast).setVisibility(View.GONE);
    mContactId = getIntent().getLongExtra("contact_id", -1);
    if (mContactId == -1) {
        Uri data = getIntent().getData();
        if (data != null) {
            try {
                mContactId = Long.parseLong(data.getLastPathSegment());
            } catch (NumberFormatException e) {
            }
        }
    }

    Bundle args = new Bundle();
    args.putLong("contact_id", mContactId);
    Fragment profileFragment = new ViewProfileFragment();
    profileFragment.setArguments(args);

    doTitleBar(this, "My Profile");
    mLabels.add("View");
    mLabels.add("Edit");
    mFragments.add(profileFragment);
    mFragments.add(new EditProfileFragment());

    Uri privateUri = Uri.parse(DungBeetleContentProvider.CONTENT_URI + "/feeds/private");
    mLabels.add("Notes");
    Fragment feedView = new FeedViewFragment();
    args = new Bundle(args);
    args.putParcelable(FeedViewFragment.ARG_FEED_URI, privateUri);
    feedView.setArguments(args);
    //mFragments.add(feedView);

    PagerAdapter adapter = new ViewFragmentAdapter(getSupportFragmentManager(), mFragments);
    mViewPager = (ViewPager) findViewById(R.id.feed_pager);
    mViewPager.setAdapter(adapter);
    mViewPager.setOnPageChangeListener(this);

    ViewGroup group = (ViewGroup) findViewById(R.id.tab_frame);
    int i = 0;
    for (String s : mLabels) {
        Button button = new Button(this);
        button.setText(s);
        button.setTextSize(18f);

        button.setLayoutParams(CommonLayouts.FULL_HEIGHT);
        button.setTag(i++);
        button.setOnClickListener(mViewSelected);

        group.addView(button);
        mButtons.add(button);
    }

    // Listen for future changes
    Uri feedUri;
    if (mContactId == Contact.MY_ID) {
        feedUri = Uri.parse(DungBeetleContentProvider.CONTENT_URI + "/feeds/me");
    } else {
        feedUri = Uri.parse(DungBeetleContentProvider.CONTENT_URI + "/contacts");
    }
    mProfileContentObserver = new ProfileContentObserver(mHandler);
    getContentResolver().registerContentObserver(feedUri, true, mProfileContentObserver);

    onPageSelected(0);

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage("Click on the avatar to take a profile picture of yourself.").setCancelable(false)
            .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {

                }
            });
    AlertDialog alert = builder.create();
    alert.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 w  ww.j  av a 2s  .  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();
}

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

public void onError(Exception exception) {
    if (mActivity == null) {
        return;/* w  w w .j ava  2s .  com*/
    }
    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);
}