Example usage for android.content DialogInterface cancel

List of usage examples for android.content DialogInterface cancel

Introduction

In this page you can find the example usage for android.content DialogInterface cancel.

Prototype

void cancel();

Source Link

Document

Cancels the dialog, invoking the OnCancelListener .

Usage

From source file:com.example.moneymeterexample.AddExpenseActivity.java

protected Dialog onCreateDialog(int id) {

    switch (id) {
    case DATE_DIALOG_ID:
        return new DatePickerDialog(this, pDateSetListener, mYear, mMonth, mDay);

    case NEW_CATEGORY_ID:
        AlertDialog.Builder new_cat_dialog = new AlertDialog.Builder(this);
        new_cat_dialog.setMessage("Enter the name of new category");
        new_cat_dialog.setTitle("New Category");
        final EditText new_cat_txt = new EditText(this);
        new_cat_dialog.setView(new_cat_txt);
        new_cat_dialog.setPositiveButton("Ok", new DialogInterface.OnClickListener() {

            @Override//from w  w  w.  ja v a 2 s  .co  m
            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
                String cat = new_cat_txt.getText().toString();

                String last = cat_list.remove((cat_list.size()) - 1);
                cat_list.add(cat);
                cat_list.add(last);
                ((BaseAdapter) category.getAdapter()).notifyDataSetChanged();

            }
        });
        new_cat_dialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
                dialog.cancel();

            }
        });

        return new_cat_dialog.create();

    case DELETE_CONFIRM_ID:
        AlertDialog.Builder delete_dialog = new AlertDialog.Builder(this);
        delete_dialog.setMessage("Are you sure you want to delete this entry?");
        delete_dialog.setTitle("Delete Confirmation");
        delete_dialog.setCancelable(false).setPositiveButton("Yes", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
                deleteRecord();
                amt.setText("");
                date.setText("");
                cat_list.remove(category.getSelectedItem().toString());
                ((BaseAdapter) category.getAdapter()).notifyDataSetChanged();
                notes.setText("");

            }
        });
        delete_dialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
                dialog.cancel();

            }
        });

        return delete_dialog.create();

    }
    return null;
}

From source file:br.liveo.ndrawer.ui.fragment.MainFragment31.java

private void updateUseBeacon(int usingPosition, int position) {
    final String usingBeaconmac = mMyDeviceAdapter.getDeviceList().get(usingPosition).getBdAddr();
    final String beaconmac = mMyDeviceAdapter.getDeviceList().get(position).getBdAddr();

    AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());
    alertDialog.setTitle("  ?");
    alertDialog.setMessage("? ? ?");
    alertDialog.setIcon(R.drawable.alert);

    alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {

            updateEvent("BEACON_USE");
            UpdateUseBeacon updateUseBeacon = new UpdateUseBeacon();
            updateUseBeacon.execute("http://125.131.73.198:3000/beaconUseUpdate", usingBeaconmac, beaconmac);
        }/*from   www.j  a  v  a 2 s  .c  om*/
    });

    alertDialog.setNegativeButton("", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });

    alertDialog.show();

}

From source file:com.affectiva.affdexme.MainActivity.java

private void showPermissionExplanationDialog(int requestCode) {
    final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(MainActivity.this);

    // set title//www. ja va  2s  .c  om
    alertDialogBuilder.setTitle(getResources().getString(R.string.insufficient_permissions));

    // set dialog message
    if (requestCode == CAMERA_PERMISSIONS_REQUEST) {
        alertDialogBuilder.setMessage(getResources().getString(R.string.permissions_camera_needed_explanation))
                .setCancelable(false).setPositiveButton(getResources().getString(R.string.understood),
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int id) {
                                dialog.cancel();
                                requestCameraPermissions();
                            }
                        });
    } else if (requestCode == EXTERNAL_STORAGE_PERMISSIONS_REQUEST) {
        alertDialogBuilder.setMessage(getResources().getString(R.string.permissions_storage_needed_explanation))
                .setCancelable(false).setPositiveButton(getResources().getString(R.string.understood),
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int id) {
                                dialog.cancel();
                                requestStoragePermissions();
                            }
                        });
    }

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

    // show it
    alertDialog.show();
}

From source file:alaindc.memenguage.View.MainActivity.java

@SuppressWarnings("StatementWithEmptyBody")
@Override/* www .  ja v  a 2 s .c o m*/
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    if (id == R.id.nav_home) {

    } else if (id == R.id.nav_settings) {
        Intent settingsActivity = new Intent(this, SettingsActivity.class);
        startActivity(settingsActivity);
    } else if (id == R.id.nav_send) {

        AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, R.style.MyDialogTheme);
        builder.setTitle("Upload Database").setMessage("Are you sure?")
                .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        progressDialog.setTitle("Upload");
                        progressDialog.setMessage("Uploading to server... please wait");
                        progressDialog.show();
                        ServerRequests.uploadFile(personId,
                                getApplicationContext().getDatabasePath(Constants.DBNAME),
                                getApplicationContext());
                    }
                }).setNegativeButton("No", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                }).create().show();

    } else if (id == R.id.nav_get) {

        AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, R.style.MyDialogTheme);
        builder.setTitle("Download Database").setMessage("Are you sure?")
                .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        progressDialog.setTitle("Download");
                        progressDialog.setMessage("Downloading from server... please wait");
                        progressDialog.show();
                        ServerRequests.downloadFile(personId,
                                getApplicationContext().getDatabasePath(Constants.DBNAME),
                                getApplicationContext());
                    }
                }).setNegativeButton("No", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                }).create().show();

    } else if (id == R.id.nav_share) {
        Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
        sharingIntent.setType("text/plain");
        String shareBody = "Memenguage, the best app on the world! Maybe.";
        sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Memento mori!");
        sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
        startActivity(Intent.createChooser(sharingIntent, "Share via"));
    } else if (id == R.id.nav_signin) {
        Intent signinintent = new Intent(this, SignInActivity.class);
        signinintent.setAction(Constants.SIGNIN_LOGOUT);
        startActivity(signinintent);
    } else if (id == R.id.nav_play) {
        Intent playActivity = new Intent(this, PlayActivity.class);
        startActivity(playActivity);
    } else if (id == R.id.nav_stats) {
        Intent statsActivity = new Intent(this, StatsActivity.class);
        startActivity(statsActivity);
    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}

From source file:com.hmatalonga.greenhub.ui.TaskListActivity.java

private void checkIfLastAppIsKilled() {
    if (mLastKilledApp != null && isKilledAppAlive(mLastKilledApp.getLabel())) {
        final String packageName = mLastKilledApp.getPackageInfo().packageName;

        AlertDialog.Builder builder = new AlertDialog.Builder(this);

        builder.setMessage(getString(R.string.kill_app_dialog_text)).setTitle(mLastKilledApp.getLabel());

        builder.setPositiveButton(R.string.force_close, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                // User clicked OK button
                startActivity(new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
                        Uri.parse("package:" + packageName)));
            }//w  w w  . jav a 2 s .  c  om
        });
        builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                // User cancelled the dialog
                dialog.cancel();
            }
        });

        builder.create().show();
    }
    mLastKilledApp = null;
}

From source file:com.piusvelte.taplock.client.core.TapLockSettings.java

@Override
protected void onListItemClick(ListView list, final View view, int position, final long id) {
    super.onListItemClick(list, view, position, id);
    mDialog = new AlertDialog.Builder(TapLockSettings.this)
            .setItems(R.array.actions_entries, new DialogInterface.OnClickListener() {
                @Override/*from w ww.j a  v  a  2s  .c  o m*/
                public void onClick(DialogInterface dialog, int which) {
                    String action = getResources().getStringArray(R.array.actions_values)[which];
                    int deviceIdx = (int) id;
                    JSONObject deviceJObj = mDevices.get(deviceIdx);
                    dialog.cancel();
                    if (ACTION_UNLOCK.equals(action) || ACTION_LOCK.equals(action)
                            || ACTION_TOGGLE.equals(action)) {
                        String name = "uknown";
                        try {
                            name = deviceJObj.getString(KEY_NAME);
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                        startActivity(TapLock.getPackageIntent(getApplicationContext(), TapLockToggle.class)
                                .setAction(action).putExtra(EXTRA_DEVICE_NAME, name));
                    } else if (ACTION_TAG.equals(action)) {
                        // write the device to a tag
                        mInWriteMode = true;
                        try {
                            mNfcAdapter.enableForegroundDispatch(TapLockSettings.this,
                                    PendingIntent.getActivity(TapLockSettings.this, 0,
                                            new Intent(TapLockSettings.this, TapLockSettings.this.getClass())
                                                    .addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP).putExtra(
                                                            EXTRA_DEVICE_NAME, deviceJObj.getString(KEY_NAME)),
                                            0),
                                    new IntentFilter[] { new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED) },
                                    null);
                        } catch (JSONException e) {
                            Log.e(TAG, e.getMessage());
                        }
                        Toast.makeText(TapLockSettings.this, "Touch tag", Toast.LENGTH_LONG).show();
                    } else if (ACTION_REMOVE.equals(action)) {
                        mDevices.remove(deviceIdx);
                        storeDevices();
                    } else if (ACTION_PASSPHRASE.equals(action))
                        setPassphrase(deviceIdx);
                    else if (ACTION_COPY_DEVICE_URI.equals(action)) {
                        ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
                        ClipData clip;
                        try {
                            clip = ClipData.newPlainText(getString(R.string.app_name), String
                                    .format(getString(R.string.device_uri), deviceJObj.get(EXTRA_DEVICE_NAME)));
                            clipboard.setPrimaryClip(clip);
                            Toast.makeText(TapLockSettings.this, "copied to clipboard!", Toast.LENGTH_SHORT)
                                    .show();
                        } catch (JSONException e) {
                            Log.e(TAG, e.getMessage());
                            Toast.makeText(TapLockSettings.this, getString(R.string.msg_oops),
                                    Toast.LENGTH_SHORT).show();
                        }
                    }
                }
            }).create();
    mDialog.show();
}

From source file:com.jonbanjo.cupsprint.CertificateActivity.java

private void removeCert(final String alias) {

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Remove Certificate?").setMessage(alias)
            .setPositiveButton("Remove", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    try {
                        trustStore.deleteEntry(alias);
                        FileOutputStream outputStream = openFileOutput(JfSSLScheme.trustfile, MODE_PRIVATE);
                        trustStore.store(outputStream, JfSSLScheme.password.toCharArray());
                        outputStream.flush();
                        outputStream.close();
                        certListAdaptor.remove(alias);
                    } catch (Exception e) {
                        System.out.println(e.toString());
                    }/*  w w w  . ja v a2s .  c o  m*/
                }
            }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
    AlertDialog dialog = builder.create();
    dialog.show();

}

From source file:com.gelakinetic.mtgfam.activities.MainActivity.java

public void showDialogFragment(final int id) {
    // DialogFragment.show() will take care of adding the fragment
    // in a transaction. We also want to remove any currently showing
    // dialog, so make our own transaction and take care of that here.
    this.showContent();
    FragmentTransaction ft = this.getSupportFragmentManager().beginTransaction();
    Fragment prev = getSupportFragmentManager().findFragmentByTag(FamiliarFragment.DIALOG_TAG);
    if (prev != null) {
        ft.remove(prev);// ww  w  .j a v a2s  .  c o  m
    }

    // Create and show the dialog.
    FamiliarDialogFragment newFragment = new FamiliarDialogFragment() {

        @Override
        public void onDismiss(DialogInterface mDialog) {
            super.onDismiss(mDialog);
            if (bounceMenu) {
                getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
                bounceMenu = false;
                Runnable r = new Runnable() {

                    @Override
                    public void run() {
                        long timeStarted = System.currentTimeMillis();
                        Message msg = Message.obtain();
                        msg.arg1 = OPEN;
                        bounceHandler.sendMessage(msg);
                        while (System.currentTimeMillis() < (timeStarted + 1500)) {
                            ;
                        }
                        msg = Message.obtain();
                        msg.arg1 = CLOSE;
                        bounceHandler.sendMessage(msg);
                        runOnUiThread(new Runnable() {

                            @Override
                            public void run() {
                                getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
                            }
                        });
                    }
                };

                Thread t = new Thread(r);
                t.start();
            }
        }

        @Override
        public Dialog onCreateDialog(Bundle savedInstanceState) {
            switch (id) {
            case DONATEDIALOG: {
                AlertDialog.Builder builder = new AlertDialog.Builder(this.getActivity());
                builder.setTitle(R.string.main_donate_dialog_title);
                builder.setNeutralButton(R.string.dialog_thanks_anyway, new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                });

                LayoutInflater inflater = this.getActivity().getLayoutInflater();
                View dialoglayout = inflater.inflate(R.layout.about_dialog,
                        (ViewGroup) findViewById(R.id.dialog_layout_root));

                TextView text = (TextView) dialoglayout.findViewById(R.id.aboutfield);
                text.setText(ImageGetterHelper.jellyBeanHack(getString(R.string.main_donate_text)));
                text.setMovementMethod(LinkMovementMethod.getInstance());

                text.setTextSize(15);

                ImageView paypal = (ImageView) dialoglayout.findViewById(R.id.imageview1);
                paypal.setImageResource(R.drawable.paypal);
                paypal.setOnClickListener(new View.OnClickListener() {

                    public void onClick(View v) {
                        Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
                                "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=SZK4TAH2XBZNC&lc=US&item_name=MTG%20Familiar&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted"));

                        startActivity(myIntent);
                    }
                });
                ((ImageView) dialoglayout.findViewById(R.id.imageview2)).setVisibility(View.GONE);

                builder.setView(dialoglayout);
                return builder.create();
            }
            case ABOUTDIALOG: {
                AlertDialog.Builder builder = new AlertDialog.Builder(this.getActivity());

                // You have to catch the exception because the package stuff is all
                // run-time
                if (pInfo != null) {
                    builder.setTitle(getString(R.string.main_about) + " " + getString(R.string.app_name) + " "
                            + pInfo.versionName);
                } else {
                    builder.setTitle(getString(R.string.main_about) + " " + getString(R.string.app_name));
                }

                builder.setNeutralButton(R.string.dialog_thanks, new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                });

                LayoutInflater inflater = this.getActivity().getLayoutInflater();
                View dialoglayout = inflater.inflate(R.layout.about_dialog,
                        (ViewGroup) findViewById(R.id.dialog_layout_root));

                TextView text = (TextView) dialoglayout.findViewById(R.id.aboutfield);
                text.setText(ImageGetterHelper.jellyBeanHack(getString(R.string.main_about_text)));
                text.setMovementMethod(LinkMovementMethod.getInstance());

                builder.setView(dialoglayout);
                return builder.create();
            }
            case CHANGELOGDIALOG: {
                AlertDialog.Builder builder = new AlertDialog.Builder(this.getActivity());

                if (pInfo != null) {
                    builder.setTitle(getString(R.string.main_whats_new_in_title) + " " + pInfo.versionName);
                } else {
                    builder.setTitle(R.string.main_whats_new_title);
                }

                builder.setNeutralButton(R.string.dialog_enjoy, new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                });

                builder.setMessage(ImageGetterHelper.jellyBeanHack(getString(R.string.main_whats_new_text)));
                return builder.create();
            }
            default: {
                savedInstanceState.putInt("id", id);
                return super.onCreateDialog(savedInstanceState);
            }
            }
        }
    };
    newFragment.show(ft, FamiliarFragment.DIALOG_TAG);
}

From source file:com.cmput301w15t15.travelclaimsapp.activitys.EditClaimActivity.java

/**
 * Function that is called when you press the add tag
 * /*from  www .ja  v a 2s . c  o m*/
 * Creates a alert dialog that gives the user the option 
 * of adding a previously added tag or entering a new tag name
 * 
 * @param view
 */
public void addTagButton(View view) {
    final EditText enterTag = new EditText(this);
    final Spinner tagSpinner = new Spinner(this);
    //Linear layout that holds enterTag and tagSpinner views
    LinearLayout ll = new LinearLayout(this);
    ll.setOrientation(LinearLayout.VERTICAL);
    tagSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View arg1, int position, long id) {
            enterTag.setText(parent.getItemAtPosition(position).toString());
        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
            // TODO Auto-generated method stub      
        }
    });

    enterTag.setHint("Enter tag");
    AlertDialog.Builder alert = new AlertDialog.Builder(this);

    //get all the tags currently added to claims in application claimlist
    ArrayList<Tag> tags = ClaimListController.getTagList();
    String t[] = new String[tags.size()];
    for (int i = 0; i < tags.size(); i++) {
        t[i] = tags.get(i).getName();
    }
    //create a arrayadaptor for displaying the tagSpinner view, and set it
    ArrayAdapter<String> tagA = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, t);
    tagSpinner.setAdapter(tagA);
    //add views to linear layout and set the Linear layout view as the alert dialog view 
    ll.addView(tagSpinner);
    ll.addView(enterTag);
    alert.setView(ll);

    alert.setPositiveButton("Add", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            Tag tag = new Tag(enterTag.getText().toString());
            if (theClaim.getTagList().getTag(enterTag.getText().toString()) != null) {
                return;
            }
            ClaimListController.addTag(theClaim, tag);
            tagAdaptor.notifyDataSetChanged();
        }
    });
    alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            dialog.cancel();
        }
    });

    alert.show();
}

From source file:com.detroitteatime.autocarfinder.Main.java

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

    isGoogleMapsInstalled();//from   ww  w  .j a  v a2s .  c o  m

    you = getResources().getDrawable(R.drawable.you);// set to person
    car = getResources().getDrawable(R.drawable.car);// set to car

    lat = carLat = Double.valueOf(data1.getString("carLat", "0"));
    longi = carLongi = Double.valueOf(data1.getString("carLng", "0"));

    yourPos = new LatLng(lat, longi);

    if (youMarker == null)
        youMarker = map.addMarker(new MarkerOptions().position(yourPos)
                .icon(BitmapDescriptorFactory.fromResource(R.drawable.you)));
    else
        youMarker.setPosition(yourPos);

    carPos = new LatLng(carLat, carLongi);

    if (carMarker == null)
        carMarker = map.addMarker(new MarkerOptions().position(carPos)
                .icon(BitmapDescriptorFactory.fromResource(R.drawable.car)));
    else
        carMarker.setPosition(carPos);

    // get distance between two points
    float[] results = new float[1];

    Location.distanceBetween(carLat, carLongi, lat, longi, results);
    d = results[0];

    distance = (TextView) findViewById(R.id.distance);

    distance.setText("Distance to car: " + Math.round(d) + " m");

    rectOptions = new PolylineOptions().add(yourPos) // Same longitude, and
            // 16km to the south
            .add(carPos).width(5).color(Color.BLUE); // Closes the polyline.

    // Get back the mutable Polyline

    if (lat == 0 && longi == 0) {

        Toast.makeText(this,
                "No location data yet, setting initial position to coordinates 0,0, making car icon invisible",
                Toast.LENGTH_LONG).show();
    }

    mapType = data1.getInt("map_type", GoogleMap.MAP_TYPE_NORMAL);

    map.setMapType(mapType);

    if (mapType == GoogleMap.MAP_TYPE_NORMAL) {

        type.setText("Change to hybrid");

    } else {

        type.setText("Change to normal");

    }

    serviceStopped = data1.getBoolean("shut_down_service", true);

    if (!serviceStopped) {

        start.setText("Stop monitoring");
        monitor.setBackgroundColor(Color.GREEN);

    } else {

        start.setText("Start monitoring");
        monitor.setBackgroundColor(Color.RED);

    }

    first = data1.getBoolean("first", true);

    editor1.putBoolean("first", false);

    if (first) {
        Builder alertDialogBuilder = new Builder(this);

        // set title
        alertDialogBuilder.setTitle("First Time");

        // set dialog message
        alertDialogBuilder.setMessage(
                "Welcome! Right now you have no car data, so your car icon will not be displayed until you drive somewhere or set your car location manually. "
                        + "If you see a blue screen with a stick man icon, the app hasn't got any data for your location yet either, and has set your coordinates to 0,0, "
                        + "which is in the Atlantic Ocean somewhere off the coast of Africa."
                        + "Also, it might be a good idea to read the info section in the menu to find out more about how this app works. Thanks for downloading"
                        + " Auto Car Finder!")
                .setCancelable(false).setNegativeButton("Ok", 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();
    }

    int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());

    if (resultCode == ConnectionResult.SUCCESS) {
        // Toast.makeText(getApplicationContext(),
        // "isGooglePlayServicesAvailable SUCCESS", Toast.LENGTH_LONG)
        // .show();

        // Register for location updates using a Criteria, and a callback on
        // the specified looper thread.
        manager.requestLocationUpdates(0L, // minTime
                0.0f, // minDistance
                criteria, // criteria
                this, // listener
                null); // looper

        // Replaces the location source of the my-location layer.
        map.setLocationSource(this);

    } else {
        GooglePlayServicesUtil.getErrorDialog(resultCode, this, RQS_GooglePlayServices);
    }

    mainLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        public void onGlobalLayout() {

            setZoom();

        }
    });

}