@Override
  protected void onRestart() {
    super.onRestart();
    // Load all groups and events to be available for offer and search rides
    Group.loadGroups(this);
    Event.loadEvents(this);

    // refresh rides
    activityFragment.sendGetRidesRequest(GETUSER_RELAVENT_RIDE_URL);

    if (!mGoogleApiClient.isConnected()) {
      mGoogleApiClient.connect();
    }
  }
  @Override
  public void onConnected(Bundle bundle) {
    // onConnected indicates that an account was selected on the device, that the selected
    // account has granted any requested permissions to our app and that we were able to
    // establish a service connection to Google Play services.
    Log.d(TAG, "onConnected:" + bundle);
    mShouldResolve = false;

    // Load all groups and events to be available for offer and search rides
    Group.loadGroups(this);
    Event.loadEvents(this);

    // Show the signed-in UI
    showSignedInUI();
  }
  private void selectEvent() {
    /* receive a list of event */
    selectEvents = Event.getAllEvents();
    final String[] eventsArray = new String[selectEvents.size()];
    for (int i = 0; i < selectEvents.size(); i++) {
      eventsArray[i] = selectEvents.get(i).getName();
    }

    AlertDialog.Builder builder1 = new AlertDialog.Builder(OfferRide.this);
    builder1.setTitle("Select Event");
    builder1.setItems(
        eventsArray,
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int position) {
            isEvent = true;
            btnSelectGroup.setEnabled(false);
            Toast.makeText(
                    getApplicationContext(),
                    "You have selected" + eventsArray[position],
                    Toast.LENGTH_SHORT)
                .show();
            eventId = selectEvents.get(position).getEventId();
            eventLocation = selectEvents.get(position).getEventLocation().getAddress();
            endAddress = selectEvents.get(position).getEventLocation().getAddress();
            tempLat = Double.toString(selectEvents.get(position).getEventLocation().getLat());
            tempLon = Double.toString(selectEvents.get(position).getEventLocation().getLon());
            AlertDialog.Builder builder3 = new AlertDialog.Builder(OfferRide.this);
            builder3.setTitle("Select type");
            builder3.setPositiveButton(
                "To this event!",
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int which) {
                    isToEvent = true;
                    latE = tempLat;
                    lonE = tempLon;
                    EditEnd.setHint(eventLocation);
                    // EditEnd.setKeyListener(null);
                    ToCurrentLocation.setEnabled(false);
                  }
                });
            builder3.setNegativeButton(
                "From this event!",
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int which) {
                    isFromEvent = true;
                    latS = tempLat;
                    lonS = tempLon;
                    EditStart.setHint(eventLocation);
                    // EditStart.setKeyListener(null);
                    FromCurrentLocation.setEnabled(false);
                    // Toast.makeText(getApplicationContext(), "You have choose to from  " +
                    // isFromEvent, Toast.LENGTH_SHORT).show();
                  }
                });
            AlertDialog alertDialog = builder3.create();
            alertDialog.show();
          }
        });

    AlertDialog alertDialog = builder1.create();
    alertDialog.show();
    System.out.println("fallie testing" + latS + lonS);
  }