private void selectGroup() { // receive a list of group selectGroups = Group.getMyGroups(); final String[] groupsArray = new String[selectGroups.size()]; for (int i = 0; i < selectGroups.size(); i++) { groupsArray[i] = selectGroups.get(i).getName(); } AlertDialog.Builder builder1 = new AlertDialog.Builder(OfferRide.this); builder1.setTitle("Select Group"); builder1.setItems( groupsArray, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int position) { btnSelectEvent.setEnabled(false); isGroup = true; // Toast.makeText(getApplicationContext(), "You have selected" + groupsArray[position], // Toast.LENGTH_SHORT).show(); groupId = selectGroups.get(position).getGroupId(); groupName = selectGroups.get(position).getName(); Toast.makeText( getApplicationContext(), "You have selected " + groupName, Toast.LENGTH_SHORT) .show(); } }); AlertDialog alertDialog = builder1.create(); alertDialog.show(); }
@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(); }