// Called when the user clicks on the quick search button public void openMainSearch(View view) { String startPositionLatitude, startPositionLongitude, edPosition, userId, startTime, endTime; String requestTime, priority; Date now = new Date(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH); startPositionLatitude = String.valueOf(Storage.getLatitude()); startPositionLongitude = String.valueOf(Storage.getLongitude()); edPosition = destination.getText().toString(); userId = ClientAuthentication.getClientId(); startTime = df.format(now); requestTime = df.format(now); endTime = "null"; priority = "distance"; if (!edPosition.trim().isEmpty() && Storage.getLatitude() != 0.0 && Storage.getLongitude() != 0.0) { SendQuickTravelRequest asyncTask = new SendQuickTravelRequest(); asyncTask.delegate = this; asyncTask.execute( userId, startTime, endTime, requestTime, startPositionLatitude, startPositionLongitude, edPosition, priority); } else if (edPosition.trim().isEmpty()) { CharSequence text = getString(R.string.java_search_enterdestination); Toast toast = Toast.makeText(context, text, Toast.LENGTH_SHORT); toast.show(); } else { CharSequence text = getString(R.string.java_search_locationdisabled); Toast toast = Toast.makeText(context, text, Toast.LENGTH_LONG); toast.show(); } }