Example usage for android.app AlertDialog show

List of usage examples for android.app AlertDialog show

Introduction

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

Prototype

public void show() 

Source Link

Document

Start the dialog and display it on screen.

Usage

From source file:com.df.app.carCheck.VehicleInfoLayout.java

/**
 * edit// w w  w.j a v a  2s.  c om
 */
private void showListDialog(int titleId, ArrayAdapter<String> adapter, final Handler handler) {
    View view1 = ((Activity) getContext()).getLayoutInflater().inflate(R.layout.popup_layout, null);

    final AlertDialog dialog = new AlertDialog.Builder(getContext()).setView(view1).create();

    TableLayout contentArea = (TableLayout) view1.findViewById(R.id.contentArea);
    final ListView listView = new ListView(view1.getContext());
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            handler.sendEmptyMessage(i);
            dialog.dismiss();
        }
    });
    contentArea.addView(listView);

    setTextView(view1, R.id.title, getResources().getString(titleId));

    dialog.show();
}

From source file:bikebadger.RideFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Log.d(Constants.APP.TAG, "RideFragment.onCreate()");
    //setRetainInstance(true);

    mRideManager = RideManager.get(getActivity());
    Log.d(Constants.APP.TAG, "mRideManager set = RideManager.get(" + getActivity() + ")");

    setHasOptionsMenu(true);//w w w .java2  s  .co  m

    // check for a Ride ID as an argument, and find the run
    Bundle args = getArguments();
    if (args != null) {
        long runId = args.getLong(ARG_RUN_ID, -1);
        Log.d(Constants.APP.TAG, "RideFragment.onCreate() runId=" + runId);
        if (runId != -1) {
            LoaderManager lm = getLoaderManager();
            lm.initLoader(LOAD_RUN, args, new RunLoaderCallbacks());
            lm.initLoader(LOAD_LOCATION, args, new LocationLoaderCallbacks());
        }
    }

    // Initialize the TextToSpeech Engine...
    // TODO this engine may not exist. Provide the ability to run without it.
    Intent checkTTSIntent = new Intent();
    checkTTSIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);

    if (checkTTSIntent.resolveActivity(mRideManager.mAppContext.getPackageManager()) != null) {
        startActivityForResult(checkTTSIntent, MY_DATA_CHECK_CODE_REQUEST);
    } else {
        Log.d(Constants.APP.TAG, "Could not find TTS Intent");
        MyToast.Show(getActivity(), "Could not find Text To Speech Service", Color.RED);
        AlertDialog ad1 = new AlertDialog.Builder(getActivity()).create();
        ad1.setCancelable(false);
        ad1.setTitle("Text To Speech Engine Not Found");
        ad1.setMessage(
                "There was a problem finding the Text To Speech Engine. Make sure it's install properly under Language and Input Settings.");
        ad1.setButton("Ok", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
        ad1.show();

    }

    if (mRideManager.mLoadLastGPXFile) {
        Log.d(Constants.APP.TAG, "mLoadLastGPXFile=" + mRideManager.mLoadLastGPXFile);
        Log.d(Constants.APP.TAG, "mCurrentGPXPath=" + mRideManager.mCurrentGPXPath);

        OpenGPXFileOnNewThreadWithDialog(mRideManager.mCurrentGPXPath);
    }

    if (!mRideManager.IsGPSEnabled()) {
        ShowAlertMessageNoGps();
    }

    // keep the screen on so it doesn't time out and turn dark
    getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

}

From source file:com.swetha.easypark.GetIndividualParkingSpotDetails.java

public void updateListView(ArrayList<LinkedHashMap<String, String>> parkingSpotMapList, int success) {
    if (success == 1) {
        mSelectedItem = 0;//from  w w w. j a v  a  2  s.  c o m
        for (int i = 0; i < parkingSpotMapList.size(); i++) {
            Log.i("GetIndividualParkingSpotDetails", "Inside For loop");
            RadioButtonTracker l_ts;
            LinkedHashMap<String, String> map = parkingSpotMapList.get(i);
            Log.i("GetIndividualParkingSpotDetails", "Value in map is " + map.get("vacantspotdisplay"));
            Log.i("GetIndividualParkingSpotDetails", "parking spoid is is " + map.get("parkingspotid"));
            if (i == mSelectedItem) {
                Log.i("GetIndividualParkingSpotDetails", "Before calling RadioButtonTracker constructor - if");
                l_ts = new RadioButtonTracker(map, true);
                Log.i("GetIndividualParkingSpotDetails", "After calling RadioButtonTracker constructor-if");
            } else {
                l_ts = new RadioButtonTracker(map, false);
            }
            mSelectionList.add(l_ts);
        }
        Log.i("GetIndividualParkingSpotDetails", "After -if-else condition");
        adapter = new RadioButtonTrackerListAdapter(mContext);
        adapter.setListItems(mSelectionList);
        Log.i("GetIndividualParkingSpotDetails", "After setListItems");
        this.setListAdapter(adapter);
        Log.i("GetIndividualParkingSpotDetails", "After setListAdapter");
    } else {
        AlertDialog alertDialog = new AlertDialog.Builder(GetIndividualParkingSpotDetails.this).create();

        // Setting Dialog Title
        alertDialog.setTitle("Sorry!");

        // Setting Dialog Message
        alertDialog.setMessage("No Parking spots found");

        // Setting Icon to Dialog
        // alertDialog.setIcon(R.drawable.tick);

        // Setting OK Button
        alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                // Write your code here to execute after dialog closed
                Intent intent = new Intent(GetIndividualParkingSpotDetails.this, GetParkingLots.class);
                startActivity(intent);
            }
        });

        // Showing Alert Message
        alertDialog.show();

    }
}

From source file:com.fabernovel.alertevoirie.ReportDetailsActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    //Log.d("AlerteVoirie_PM", "Result : " + requestCode);
    switch (requestCode) {
    case R.id.existing_incidents_add_picture:
    case R.id.ImageView_far:
    case R.id.ImageView_close:
        if (resultCode == RESULT_OK) {
            try {

                String finalPath;

                if (data != null) {
                    Uri path = data.getData();
                    // OI FILE Manager
                    String filemanagerString = path.getPath();
                    // MEDIA GALLERY
                    String selectedImagePath = getPath(path);

                    if (selectedImagePath != null) {
                        finalPath = selectedImagePath;
                        System.out.println("selectedImagePath is the right one for you! " + finalPath);
                    } else {
                        finalPath = filemanagerString;
                        System.out.println("filemanagerstring is the right one for you!" + finalPath);
                    }/* ww w.ja  v  a2s .c  o  m*/
                    // boolean isImage = true;
                } else {
                    finalPath = uriOfPicFromCamera.getPath();
                }

                // if (data == null || getMimeType(finalPath).startsWith("image")) {
                InputStream in;
                BitmapFactory.Options opt = new BitmapFactory.Options();

                // get the sample size to have a smaller image
                in = getContentResolver().openInputStream(Uri.fromFile(new File(finalPath)));
                opt.inSampleSize = getSampleSize(
                        getContentResolver().openInputStream(Uri.fromFile(new File(finalPath))));
                in.close();

                // decode a sampled version of the picture
                in = getContentResolver().openInputStream(Uri.fromFile(new File(finalPath)));
                Bitmap picture = BitmapFactory.decodeStream(in, null, opt);

                // Bitmap picture = BitmapFactory.decodeFile(finalPath);
                in.close();

                File f = new File(uriOfPicFromCamera.getPath());
                f.delete();

                // save the new image
                String pictureName = requestCode == R.id.ImageView_close ? CAPTURE_CLOSE : CAPTURE_FAR;
                FileOutputStream fos = openFileOutput(pictureName, MODE_PRIVATE);

                picture.compress(CompressFormat.JPEG, 80, fos);
                fos.close();

                if (requestCode == R.id.ImageView_far || mAdditionalImageType == ADDITIONAL_IMAGE_TYPE_FAR) {
                    loadZoom();
                } else if (mAdditionalImageType == ADDITIONAL_IMAGE_TYPE_CLOSE) {
                    File img = new File(getFilesDir() + "/" + CAPTURE_FAR);
                    mCurrentAction = ACTION_ADD_IMAGE;
                    timeoutHandler.postDelayed(timeout, TIMEOUT);
                    AVService.getInstance(this).postImage(this, Utils.getUdid(this), "",
                            Long.toString(currentIncident.id), null, img, false);
                }

                if (requestCode != R.id.existing_incidents_add_picture) {
                    setPictureToImageView(pictureName, (ImageView) findViewById(requestCode));
                }

                if (requestCode == R.id.ImageView_far
                        && ((TextView) findViewById(R.id.TextView_address)).getText().length() > 0) {
                    ((Button) findViewById(R.id.Button_validate)).setEnabled(true);
                }
                // }

                // FileOutputStream fos = openFileOutput("capture", MODE_WORLD_READABLE);
                // InputStream in = getContentResolver().openInputStream(uriOfPicFromCamera);
                // Utils.fromInputToOutput(in, fos);
                // fos.close();
                // in.close();

                mAdditionalImageType = 0;
            } catch (FileNotFoundException e) {
                Log.e("AlerteVoirie_PM", "", e);
            } catch (IOException e) {
                Log.e("AlerteVoirie_PM", "", e);
            } catch (NullPointerException e) {
                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                AlertDialog alert;
                builder.setMessage("Image invalide").setCancelable(false).setPositiveButton("Ok", null);
                alert = builder.create();
                alert.show();
            }

        } else if (resultCode == RESULT_CANCELED) {
            if (uriOfPicFromCamera != null) {
                File tmpFile = new File(uriOfPicFromCamera.getPath());
                tmpFile.delete();
                uriOfPicFromCamera = null;
            }
        }
        break;

    case REQUEST_CATEGORY:
        if (resultCode == RESULT_OK) {
            setCategory(data.getLongExtra(IntentData.EXTRA_CATEGORY_ID, -1));
            // TODO do this when update request ready
            findViewById(R.id.Button_validate).setVisibility(View.VISIBLE);
        }
        break;
    case REQUEST_POSITION:
        if (resultCode == RESULT_OK) {
            currentIncident.address = data.getStringExtra(IntentData.EXTRA_ADDRESS);
            currentIncident.longitude = data.getDoubleExtra(IntentData.EXTRA_LONGITUDE, 0);
            currentIncident.latitude = data.getDoubleExtra(IntentData.EXTRA_LATITUDE, 0);
            ((TextView) findViewById(R.id.TextView_address)).setText(currentIncident.address);
            if (currentIncident.address != null && currentIncident.address.length() > 0 && canvalidate) {
                ((Button) findViewById(R.id.Button_validate)).setEnabled(true);
            }
            findViewById(R.id.Button_validate).setVisibility(View.VISIBLE);
        }
        break;
    case REQUEST_COMMENT:
        if (resultCode == RESULT_OK) {
            currentIncident.description = data.getStringExtra(IntentData.EXTRA_COMMENT);
            ((TextView) findViewById(R.id.TextView_comment)).setText(currentIncident.description);
            if (currentIncident.description != null)
                findViewById(R.id.TextView_nocomment).setVisibility(View.GONE);
            // findViewById(R.id.Button_validate).setVisibility(View.VISIBLE);
        }
        break;
    case REQUEST_IMAGE_COMMENT:
        if (resultCode == RESULT_OK) {
            showDialog(DIALOG_PROGRESS);
            File img = new File(getFilesDir() + "/arrowed.jpg");
            mCurrentAction = ACTION_ADD_IMAGE;
            timeoutHandler.postDelayed(timeout, TIMEOUT);
            AVService.getInstance(this).postImage(this, Utils.getUdid(this),
                    data.getStringExtra(IntentData.EXTRA_COMMENT), Long.toString(currentIncident.id), img, null,
                    false);
        }
        break;
    case REQUEST_COMMENT_BEFORE_EXIT:
        if (resultCode == RESULT_OK) {
            currentIncident.description = data.getStringExtra(IntentData.EXTRA_COMMENT);
            ((TextView) findViewById(R.id.TextView_comment)).setText(currentIncident.description);
            postNewIncident();
        }
        break;
    case REQUEST_DETAILS:
        if (resultCode == RESULT_OK) {
            // startActivityForResult(data, requestCode)

            if (mCurrentAction == ACTION_ADD_IMAGE) {
                Intent i = new Intent(getApplicationContext(), AddCommentActivity.class);
                startActivityForResult(i, REQUEST_IMAGE_COMMENT);
            } else {
                // set new img
                setPictureToImageView("arrowed.jpg", (ImageView) findViewById(R.id.ImageView_far));
                loadComment(REQUEST_COMMENT);
            }

        }
        break;
    default:
        super.onActivityResult(requestCode, resultCode, data);
        break;
    }
}

From source file:com.oasis.sdk.activity.GooglePlayBillingActivity.java

/**
 * ??????/*w  w  w . j a  va 2  s.  c o  m*/
 * @param purchase
 */
void alert(final Purchase purchase) {
    final AlertDialog d = new AlertDialog.Builder(this).create();
    d.show();
    d.setContentView(BaseUtils.getResourceValue("layout", "oasisgames_sdk_common_dialog_notitle"));
    d.setCanceledOnTouchOutside(false);
    d.setCancelable(false);
    TextView retry = (TextView) d
            .findViewById(BaseUtils.getResourceValue("id", "oasisgames_sdk_common_dialog_notitle_sure"));
    retry.setText(getResources()
            .getString(BaseUtils.getResourceValue("string", "oasisgames_sdk_pay_google_notice_alert_retry")));
    retry.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // ?
            d.dismiss();
            setWaitScreen(true);
            check(purchase);
        }
    });
    TextView close = (TextView) d
            .findViewById(BaseUtils.getResourceValue("id", "oasisgames_sdk_common_dialog_notitle_cancle"));
    close.setText(getResources()
            .getString(BaseUtils.getResourceValue("string", "oasisgames_sdk_pay_google_notice_alert_close")));
    close.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            d.dismiss();
            setResultInfo(OASISPlatformConstant.RESULT_EXCEPTION_GOOGLEPAY_EXCEPTION,
                    "?????");
            close();
        }
    });

    TextView content = (TextView) d
            .findViewById(BaseUtils.getResourceValue("id", "oasisgames_sdk_common_dialog_notitle_content"));
    content.setText(getResources()
            .getString(BaseUtils.getResourceValue("string", "oasisgames_sdk_pay_google_notice_alert_content")));

}

From source file:bikebadger.RideFragment.java

public void onActivityResult(int requestCode, int resultCode, Intent data) {

    switch (requestCode) {
    case MY_DATA_CHECK_CODE_REQUEST:
        // for testing
        //resultCode = TextToSpeech.Engine.CHECK_VOICE_DATA_FAIL;
        switch (resultCode) {
        case TextToSpeech.Engine.CHECK_VOICE_DATA_PASS:
            RideManager.mTTS = new TextToSpeech(mRideManager.mAppContext, this);
            //RideManager.mTTS = null;
            Log.v(Constants.APP.TAG, "TextToSpeech installed");
            break;
        case TextToSpeech.Engine.CHECK_VOICE_DATA_BAD_DATA:
        case TextToSpeech.Engine.CHECK_VOICE_DATA_MISSING_DATA:
        case TextToSpeech.Engine.CHECK_VOICE_DATA_MISSING_VOLUME:
        case TextToSpeech.Engine.CHECK_VOICE_DATA_FAIL:

            Log.e(Constants.APP.TAG, "Got a failure. Text To Speech not available");

            AlertDialog ad = new AlertDialog.Builder(getActivity()).create();
            ad.setCancelable(false);// w w  w. j av a2 s  . c  om
            ad.setTitle("Text To Speech Engine Not Found");
            ad.setMessage(
                    "There was a problem finding the Text To Speech Engine. Make sure it's install properly under Language and Input Settings.");
            ad.setButton("Ok", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            });
            ad.show();

            // missing data, install it
            //Log.v(Constants.APP.TAG, "Need language stuff: " + resultCode);
            //Intent installIntent = new Intent();
            //installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
            //startActivity(installIntent);
            break;
        }

        break;
    /* No longer used as it is deprecated. Use SimpleFileDialog instead even though it blocks.
    TODO - integrate a slick open file that includes DropBox and Drive library!
    case Constants.APP.FILE_CHOOSER_REQUEST_CODE:
            
        if (resultCode == getActivity().RESULT_OK) {
            if (data != null) {
                // Get the URI of the selected file
                final Uri uri = data.getData();
                Log.i(Constants.APP.TAG, "Uri = " + uri.toString());
                try {
                    // Get the file path from the URI
                    final String path = FileUtils.getPath(mRideManager.mAppContext, uri);
                    //Toast.makeText(getActivity(), "File Selected: " + path, Toast.LENGTH_LONG).show();
                    OpenGPXFileOnNewThreadWithDialog(path);
                   // if(isVisible())
                     //    updateUI(); // update title bar file loaded
                } catch (Exception e) {
                    Log.e("FileSelectorTestActivity", "File select error", e);
                }
            }
        }
        break;
         */
    case Constants.APP.ACTION_WAYPOINT_REQUEST_CODE:
        if (resultCode == getActivity().RESULT_OK) {
            if (data != null) {
                final Location location = data.getParcelableExtra("location");
                String command = data.getStringExtra("command");
                final String arg = data.getStringExtra("argument");

                mRideManager.AddNewWaypoint(command, arg, location);
                // enable the save menu
                mMenu.findItem(R.id.menu_item_gpx_save).setEnabled(true);
            }
        }
        break;
    case MY_MAP_CODE_REQUEST:

        if (resultCode == getActivity().RESULT_OK) {
            Log.d(Constants.APP.TAG, "Return from map");
        }
        break;
    }

    super.onActivityResult(requestCode, resultCode, data);
}

From source file:com.VVTeam.ManHood.Fragment.HistogramFragment.java

private void showDisableMessage() {

    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());

    // set title/*from   w ww  .j  ava2s .  co m*/
    alertDialogBuilder.setTitle("Join the Inner Circle!");

    // set dialog message
    alertDialogBuilder.setMessage("This feature is not available in the Beta version.").setCancelable(false)
            .setPositiveButton("Cancel", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });

    // create alert dialog
    AlertDialog alertDialog = alertDialogBuilder.create();

    // show it
    alertDialog.show();
}

From source file:com.safecell.LoginActivity.java

void showProfileList() {
    try {/*from w ww  . jav a  2s .co m*/
        JSONObject loginResponceJsonObject = new JSONObject(loginResponce);

        // Log.v("Safecell:", "JSONObject "
        // +loginResponceJsonObject.toString(4));
        accountJO = loginResponceJsonObject.getJSONObject("account");
        profilesJA = accountJO.getJSONArray("profiles");

        profileName = new String[profilesJA.length()];
        profileIDArray = new int[profilesJA.length()];

        for (int i = 0; i < profilesJA.length(); i++) {
            profileJO = profilesJA.getJSONObject(i);
            profileName[i] = profileJO.getString("first_name") + " " + profileJO.getString("last_name");
            profileIDArray[i] = profileJO.getInt("id");
        }

        selectedProfile = new JSONObject();

        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Select Profile");
        builder.setItems(profileName, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int item) {
                if (NetWork_Information.isNetworkAvailable(LoginActivity.this)) {

                    try {
                        selectedProfile = profilesJA.getJSONObject(item);
                        // check that profile already logged in
                        boolean is_app_installed = selectedProfile.getBoolean("is_app_installed");
                        Log.v(TAG, "is_app_installed: " + is_app_installed);
                        if (is_app_installed) {
                            Log.e(TAG, "Blocking login...");
                            Toast.makeText(context, "Profile already in use in another device.",
                                    Toast.LENGTH_LONG).show();
                            quitDialog(context, "Profile in use", "Profile already in use in another device.");
                        } else {
                            Log.e(TAG, "Allowing login...");

                            progressDialog.setMessage("Loading Please Wait");

                            progressDialog.show();

                            progressDialog.setCancelable(cancelSelectProfile);
                            // setting selected index into
                            // preferences
                            new ConfigurePreferences(context).setProfileIndex(String.valueOf(item));
                            new ConfigurePreferences(context).setSelectedProfile(selectedProfile.toString());
                            // Checking profile license information
                            // empty or not
                            String manager_id = selectedProfile.getString("manager_id");
                            String start_date = selectedProfile.getString("license_startdate");
                            String subscription = selectedProfile.getString("license_subsription");

                            // store details in shared preferences
                            ConfigurePreferences preferences = new ConfigurePreferences(context);
                            preferences.set_ProfileID(selectedProfile.getString("id"));
                            preferences.set_AccountID(selectedProfile.getString("account_id"));
                            preferences.set_ManagerID(manager_id);
                            preferences.set_LicenseStartDate(start_date);
                            preferences.set_LicenseSubscription(subscription);

                            // check manager account
                            if (manager_id.equals("0")) {
                                Log.d(TAG, "Manager profile");
                                UIUtils.OkDialog(context,
                                        "Cannot login with Manager Account. Please provide a registered device user.");
                                progressDialog.dismiss();
                                return;
                            }

                            // Check account is active or inactive

                            // validate account activation
                            boolean account_status = validateAccountActive(selectedProfile);
                            if (account_status) {
                                Log.v(TAG, "Account is activated...");
                                TrackingService.AccountActive = true;
                            } else {
                                Log.v(TAG, "Account is not activated yet..");
                                quitDialog(context, "Activation", TAGS.TAG_INACTIVE);
                                return;
                            }
                            // check start date empty
                            if (start_date.isEmpty() || start_date.equalsIgnoreCase(" ") || start_date == "null"
                                    || start_date.equals("null") || subscription.isEmpty()
                                    || subscription.equalsIgnoreCase(" ") || subscription == "null"
                                    || subscription.equals("null")) {
                                Log.e(TAG, "Profile license null");
                                UIUtils.OkDialog(context, "No profile license information in server .");
                                progressDialog.dismiss();
                                return;
                            }

                            // check license start date of profile
                            boolean start_status = TrailCheck.validateStartDate(context, start_date);
                            Log.d(TAG, "start date validation status = " + start_status);
                            if (start_status) {
                                Log.e(TAG, "Your license not started yet");
                                String startdate = start_date.split("T")[0];
                                quitDialog(context, "Licence", "You are authorize to use the application from "
                                        + startdate + ". Please login on that date");
                                progressDialog.dismiss();
                                return;
                            }

                            Log.d(TAG, "License subscription: " + subscription);
                            // check license expire date of profile
                            boolean expire = TrailCheck.validateExpireOn(context, start_date, subscription);
                            long remain_days = TrailCheck.getRemain_days();
                            if (expire) {
                                String exipredate = TrailCheck.expire_date.split(" ")[0];
                                Log.e(TAG, "Trail expired");
                                quitDialog(context, TrailCheck.title, "You SafeCell license expired on "
                                        + exipredate
                                        + " .Please log on the www.safecellapp.mobi with your userid and password and renew the license.");
                                progressDialog.dismiss();
                                return;
                            }
                            if (remain_days < 30 && !expire) {

                                AlertDialog dialog_screen = new AlertDialog.Builder(context)
                                        .setMessage(TrailCheck.messsge)
                                        .setNeutralButton("Ok", new DialogInterface.OnClickListener() {

                                            @Override
                                            public void onClick(DialogInterface dialog, int which) {

                                                dialog.cancel();
                                                mThread1.start();

                                            }
                                        }).create();
                                dialog_screen.show();

                            } else {
                                mThread1.start();
                            }
                        }
                    } catch (Exception e) {
                        Log.d(TAG, "Exception while checking license");
                        e.printStackTrace();
                    }

                } else {

                    Log.d(TAG, "No network information available");
                    NetWork_Information.noNetworkConnectiondialog(LoginActivity.this);

                }

            }
        });
        AlertDialog alert = builder.create();
        alert.show();

    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:com.VVTeam.ManHood.Fragment.HistogramFragment.java

private void showClosestNeedMesurementMessage() {

    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());

    // set title/*from   w  ww .ja  v  a  2s .c o m*/
    alertDialogBuilder.setTitle("Measurement needed to see the Area around you");

    // set dialog message
    alertDialogBuilder.setMessage("To see the close by, you need to get yourself measured").setCancelable(false)
            .setPositiveButton("How-To", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {

                    ((MainActivity) getActivity()).openGuideActivity();

                }
            }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    // if this button is clicked, just close
                    // the dialog box and do nothing
                    dialog.cancel();
                }
            });

    // create alert dialog
    AlertDialog alertDialog = alertDialogBuilder.create();

    // show it
    alertDialog.show();
}

From source file:com.VVTeam.ManHood.Fragment.HistogramFragment.java

private void showMesurementMessage() {
    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());

    // set title/*w  w  w.  j  a  v  a2  s . c  o  m*/
    alertDialogBuilder.setTitle("Mapping the world, Hood by Hood");

    // set dialog message
    alertDialogBuilder.setMessage("Start with yourself first").setCancelable(false)
            .setPositiveButton("How-To", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {

                    ((MainActivity) getActivity()).openGuideActivity();

                }
            }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    // if this button is clicked, just close
                    // the dialog box and do nothing
                    dialog.cancel();
                }
            });

    // create alert dialog
    AlertDialog alertDialog = alertDialogBuilder.create();

    // show it
    alertDialog.show();

}