List of usage examples for android.net Uri toString
public abstract String toString();
From source file:gc.david.dfm.ui.MainActivity.java
/** * Handles a send intent with position data. * * @param intent Input intent with position data. *//*from www . j a v a2 s.com*/ private void handleViewPositionIntent(final Intent intent) throws Exception { Mint.leaveBreadcrumb("MainActivity::handleViewPositionIntent"); final Uri uri = intent.getData(); Mint.addExtraData("queryParameter", uri.toString()); final String uriScheme = uri.getScheme(); if (uriScheme.equals("geo")) { final String schemeSpecificPart = uri.getSchemeSpecificPart(); final Matcher matcher = getMatcherForUri(schemeSpecificPart); if (matcher.find()) { if (matcher.group(1).equals("0") && matcher.group(2).equals("0")) { if (matcher.find()) { // Manage geo:0,0?q=lat,lng(label) setDestinationPosition(matcher); } else { // Manage geo:0,0?q=my+street+address String destination = Uri.decode(uri.getQuery()).replace('+', ' '); destination = destination.replace("q=", ""); // TODO check this ugly workaround new SearchPositionByName().execute(destination); mustShowPositionWhenComingFromOutside = true; } } else { // Manage geo:latitude,longitude or geo:latitude,longitude?z=zoom setDestinationPosition(matcher); } } else { final NoSuchFieldException noSuchFieldException = new NoSuchFieldException( "Error al obtener las coordenadas. Matcher = " + matcher.toString()); Mint.logException(noSuchFieldException); throw noSuchFieldException; } } else if ((uriScheme.equals("http") || uriScheme.equals("https")) && (uri.getHost().equals("maps.google.com"))) { // Manage maps.google.com?q=latitude,longitude final String queryParameter = uri.getQueryParameter("q"); if (queryParameter != null) { final Matcher matcher = getMatcherForUri(queryParameter); if (matcher.find()) { setDestinationPosition(matcher); } else { final NoSuchFieldException noSuchFieldException = new NoSuchFieldException( "Error al obtener las coordenadas. Matcher = " + matcher.toString()); Mint.logException(noSuchFieldException); throw noSuchFieldException; } } else { final NoSuchFieldException noSuchFieldException = new NoSuchFieldException( "Query sin parmetro q."); Mint.logException(noSuchFieldException); throw noSuchFieldException; } } else { final Exception exception = new Exception("Imposible tratar la query " + uri.toString()); Mint.logException(exception); throw exception; } }
From source file:com.cloudbees.gasp.service.RESTService.java
@Override protected void onHandleIntent(Intent intent) { // When an intent is received by this Service, this method // is called on a new thread. Uri action = intent.getData(); Bundle extras = intent.getExtras();/*from w w w . jav a 2 s.c o m*/ if (extras == null || action == null || !extras.containsKey(EXTRA_RESULT_RECEIVER)) { // Extras contain our ResultReceiver and data is our REST action. // So, without these components we can't do anything useful. Log.e(TAG, "You did not pass extras or data with the Intent."); return; } // We default to GET if no verb was specified. int verb = extras.getInt(EXTRA_HTTP_VERB, GET); Bundle params = extras.getParcelable(EXTRA_PARAMS); ResultReceiver receiver = extras.getParcelable(EXTRA_RESULT_RECEIVER); try { // Here we define our base request object which we will // send to our REST service via HttpClient. HttpRequestBase request = null; // Let's build our request based on the HTTP verb we were // given. switch (verb) { case GET: { request = new HttpGet(); attachUriWithQuery(request, action, params); } break; case DELETE: { request = new HttpDelete(); attachUriWithQuery(request, action, params); } break; case POST: { request = new HttpPost(); request.setURI(new URI(action.toString())); // Attach form entity if necessary. Note: some REST APIs // require you to POST JSON. This is easy to do, simply use // postRequest.setHeader('Content-Type', 'application/json') // and StringEntity instead. Same thing for the PUT case // below. HttpPost postRequest = (HttpPost) request; if (params != null) { UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(paramsToList(params)); postRequest.setEntity(formEntity); } } break; case PUT: { request = new HttpPut(); request.setURI(new URI(action.toString())); // Attach form entity if necessary. HttpPut putRequest = (HttpPut) request; if (params != null) { UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(paramsToList(params)); putRequest.setEntity(formEntity); } } break; } if (request != null) { HttpClient client = new DefaultHttpClient(); // Let's send some useful debug information so we can monitor things // in LogCat. Log.d(TAG, "Executing request: " + verbToString(verb) + ": " + action.toString()); // Finally, we send our request using HTTP. This is the synchronous // long operation that we need to run on this thread. HttpResponse response = client.execute(request); HttpEntity responseEntity = response.getEntity(); StatusLine responseStatus = response.getStatusLine(); int statusCode = responseStatus != null ? responseStatus.getStatusCode() : 0; // Our ResultReceiver allows us to communicate back the results to the caller. This // class has a method named send() that can send back a code and a Bundle // of data. ResultReceiver and IntentService abstract away all the IPC code // we would need to write to normally make this work. if (responseEntity != null) { Bundle resultData = new Bundle(); resultData.putString(REST_RESULT, EntityUtils.toString(responseEntity)); receiver.send(statusCode, resultData); } else { receiver.send(statusCode, null); } } } catch (URISyntaxException e) { Log.e(TAG, "URI syntax was incorrect. " + verbToString(verb) + ": " + action.toString(), e); receiver.send(0, null); } catch (UnsupportedEncodingException e) { Log.e(TAG, "A UrlEncodedFormEntity was created with an unsupported encoding.", e); receiver.send(0, null); } catch (ClientProtocolException e) { Log.e(TAG, "There was a problem when sending the request.", e); receiver.send(0, null); } catch (IOException e) { Log.e(TAG, "There was a problem when sending the request.", e); receiver.send(0, null); } }
From source file:com.phonegap.CameraLauncher.java
/** * Called when the camera view exits. //from w ww.j ava 2s . com * * @param requestCode The request code originally supplied to startActivityForResult(), * allowing you to identify who this result came from. * @param resultCode The integer result code returned by the child activity through its setResult(). * @param intent An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). */ public void onActivityResult(int requestCode, int resultCode, Intent intent) { // Get src and dest types from request code int srcType = (requestCode / 16) - 1; int destType = (requestCode % 16) - 1; // If CAMERA if (srcType == CAMERA) { // If image available if (resultCode == Activity.RESULT_OK) { try { // Read in bitmap of captured image Bitmap bitmap = android.provider.MediaStore.Images.Media .getBitmap(this.ctx.getContentResolver(), imageUri); // If sending base64 image back if (destType == DATA_URL) { this.processPicture(bitmap); } // If sending filename back else if (destType == FILE_URI) { // Create entry in media store for image // (Don't use insertImage() because it uses default compression setting of 50 - no way to change it) ContentValues values = new ContentValues(); values.put(android.provider.MediaStore.Images.Media.MIME_TYPE, "image/jpeg"); Uri uri = null; try { uri = this.ctx.getContentResolver() .insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); } catch (UnsupportedOperationException e) { System.out.println("Can't write to external media storage."); try { uri = this.ctx.getContentResolver().insert( android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI, values); } catch (UnsupportedOperationException ex) { System.out.println("Can't write to internal media storage."); this.failPicture("Error capturing image - no media storage found."); return; } } // Add compressed version of captured image to returned media store Uri OutputStream os = this.ctx.getContentResolver().openOutputStream(uri); bitmap.compress(Bitmap.CompressFormat.JPEG, this.mQuality, os); os.close(); // Send Uri back to JavaScript for viewing image this.success(new PluginResult(PluginResult.Status.OK, uri.toString()), this.callbackId); } bitmap.recycle(); bitmap = null; System.gc(); } catch (IOException e) { e.printStackTrace(); this.failPicture("Error capturing image."); } } // If cancelled else if (resultCode == Activity.RESULT_CANCELED) { this.failPicture("Camera cancelled."); } // If something else else { this.failPicture("Did not complete!"); } } // If retrieving photo from library else if ((srcType == PHOTOLIBRARY) || (srcType == SAVEDPHOTOALBUM)) { if (resultCode == Activity.RESULT_OK) { Uri uri = intent.getData(); android.content.ContentResolver resolver = this.ctx.getContentResolver(); // If sending base64 image back if (destType == DATA_URL) { try { Bitmap bitmap = android.graphics.BitmapFactory.decodeStream(resolver.openInputStream(uri)); this.processPicture(bitmap); bitmap.recycle(); bitmap = null; System.gc(); } catch (FileNotFoundException e) { e.printStackTrace(); this.failPicture("Error retrieving image."); } } // If sending filename back else if (destType == FILE_URI) { this.success(new PluginResult(PluginResult.Status.OK, uri.toString()), this.callbackId); } } else if (resultCode == Activity.RESULT_CANCELED) { this.failPicture("Selection cancelled."); } else { this.failPicture("Selection did not complete!"); } } }
From source file:org.planetmono.dcuploader.ActivityUploader.java
@SuppressWarnings("unchecked") @Override/*from w ww . j ava 2 s .co m*/ public void onCreate(Bundle savedState) { super.onCreate(savedState); initViews(); if (formLocation) queryLocation(true); if (savedState != null) { if (savedState.containsKey("tempfile")) tempFile = new File(savedState.getString("tempfile")); if (savedState.containsKey("target")) resolveTarget(savedState.getString("target")); if (savedState.containsKey("tempfiles")) tempFiles = savedState.getStringArrayList("tempfiles"); if (savedState.containsKey("contents")) { contents = new ArrayList<Uri>(); String[] carr = savedState.getStringArray("contents"); for (String s : carr) contents.add(Uri.parse(s)); } } postfix = "from <a href=\"http://palladium.planetmono.org/dcuploader\">DCUploader</a>"; Button uploadVisit = (Button) findViewById(R.id.upload_visit); if (passThrough || target == null) uploadVisit.setEnabled(false); else uploadVisit.setEnabled(true); /* populate data by getting STREAM parameter */ Intent i = getIntent(); Bundle b = i.getExtras(); String action = i.getAction(); if (action.equals(Intent.ACTION_SEND) || action.equals(Intent.ACTION_SEND_MULTIPLE)) { called = true; if (i.hasExtra(Intent.EXTRA_STREAM)) { Object o = b.get(Intent.EXTRA_STREAM); /* quick and dirty. any better idea? */ try { contents.add((Uri) o); } catch (Exception e1) { try { contents = (ArrayList<Uri>) ((ArrayList<Uri>) o).clone(); } catch (Exception e2) { } } boolean exceeded = false; if (contents.size() > 5) { exceeded = true; do { contents.remove(5); } while (contents.size() > 5); } galleryChanged = true; updateImageButtons(); resetThumbnails(); updateGallery(); if (exceeded) Toast.makeText(this, " 5 . 5 ??? ? ?.", Toast.LENGTH_LONG).show(); } if (i.hasExtra(Intent.EXTRA_TEXT)) { ((EditText) findViewById(R.id.upload_text)).setText(b.getString(Intent.EXTRA_TEXT)); } } else if (action.equals("share")) { called = true; /* HTC web browser uses non-standard intent */ ((EditText) findViewById(R.id.upload_text)).setText(b.getString(Intent.EXTRA_TITLE)); } else if (action.equals(Intent.ACTION_VIEW)) { Uri uri = i.getData(); if (i.getCategories().contains(Intent.CATEGORY_BROWSABLE)) { passThrough = true; Pattern p = Pattern.compile("id=([\\-a-zA-Z0-9_]+)"); Matcher m = p.matcher(uri.toString()); if (m.find()) { resolveTarget(m.group(1)); } else { passThrough = false; } if (uri.getHost().equals(Application.HOST_DCMYS)) { destination = Application.DESTINATION_DCMYS; postfix = "from dc.m.dcmys.kr w/ <a href=\"http://palladium.planetmono.org/dcuploader\">DCUploader</a>"; } else if (uri.getHost().equals(Application.HOST_MOOLZO)) { destination = Application.DESTINATION_MOOLZO; postfix = "- From m.oolzo.com w/ <a href=\"http://palladium.planetmono.org/dcuploader\">DCUploader</a>"; } else if (uri.getHost().equals(Application.HOST_DCINSIDE)) { destination = Application.DESTINATION_DCINSIDE; } setDefaultImage(); } } reloadConfigurations(); }
From source file:com.snipme.record.Record.java
/** * Creates a JSONObject that represents a File from the Uri * * @param data the Uri of the audio/image/video * @return a JSONObject that represents a File * @throws IOException/*from ww w . ja v a 2 s.c o m*/ */ private JSONObject createMediaFile(Uri data) { File fp = webView.getResourceApi().mapUriToFile(data); JSONObject obj = new JSONObject(); Class webViewClass = webView.getClass(); PluginManager pm = null; try { Method gpm = webViewClass.getMethod("getPluginManager"); pm = (PluginManager) gpm.invoke(webView); } catch (NoSuchMethodException e) { } catch (IllegalAccessException e) { } catch (InvocationTargetException e) { } if (pm == null) { try { Field pmf = webViewClass.getField("pluginManager"); pm = (PluginManager) pmf.get(webView); } catch (NoSuchFieldException e) { } catch (IllegalAccessException e) { } } FileUtils filePlugin = (FileUtils) pm.getPlugin("File"); LocalFilesystemURL url = filePlugin.filesystemURLforLocalPath(fp.getAbsolutePath()); try { // File properties obj.put("name", fp.getName()); obj.put("fullPath", fp.toURI().toString()); if (url != null) { obj.put("localURL", url.toString()); } // Because of an issue with MimeTypeMap.getMimeTypeFromExtension() all .3gpp files // are reported as video/3gpp. I'm doing this hacky check of the URI to see if it // is stored in the audio or video content store. if (fp.getAbsoluteFile().toString().endsWith(".3gp") || fp.getAbsoluteFile().toString().endsWith(".3gpp")) { if (data.toString().contains("/audio/")) { obj.put("type", AUDIO_3GPP); } else { obj.put("type", VIDEO_3GPP); } } else { obj.put("type", FileHelper.getMimeType(Uri.fromFile(fp), cordova)); } obj.put("lastModifiedDate", fp.lastModified()); obj.put("size", fp.length()); } catch (JSONException e) { // this will never happen e.printStackTrace(); } return obj; }
From source file:illab.nabal.NabalSimpleDemoActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // if request code is sent from here and the result is ok if (requestCode == REQ_CODE_FETCH_BITMAP_FROM_GALLERY && resultCode == RESULT_OK) { Uri imgUri = data.getData(); // if user has selected a photo from Gallery if (imgUri.toString().startsWith("content://media") == true) { // imgUri : content://media/external/images/media/13570 String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(imgUri, filePathColumn, null, null, null); if (cursor.moveToFirst() == true) { int columnIndex = cursor.getColumnIndex(filePathColumn[0]); // go post this photo with description mTmpImgFilePath = cursor.getString(columnIndex); postPhoto(mTmpImgFilePath, mEditText1.getText().toString()); // uncomment and use Bitmap object to handle the selected bitmap image //Bitmap bitmap = BitmapFactory.decodeFile(mTmpImgFilePath); }/*from www. ja va2s .c o m*/ cursor.close(); } else { // if user has selected a photo from Google Photo if (imgUri.toString().indexOf("com.google.android.apps.photos") > -1 && (imgUri.toString().indexOf("http%3A%2F%2F") > -1 || imgUri.toString().indexOf("https%3A%2F%2F") > -1)) { try { String imgUrl = imgUri.toString(); int urlStartIndex = (imgUri.toString().indexOf("http%3A%2F%2F") > -1) ? imgUri.toString().indexOf("http%3A%2F%2F") : imgUri.toString().indexOf("https%3A%2F%2F"); String remotePhotoUrl = URLDecoder.decode(imgUrl.substring(urlStartIndex), HTTP.UTF_8); mDialogHelper.toast("Downloading the selected image...", Toast.LENGTH_LONG); fetchRemotePhoto(remotePhotoUrl); } catch (UnsupportedEncodingException e) { String errMessage = "Failed to parse image URL."; Log.e(TAG, errMessage); mDialogHelper.toast(errMessage, Toast.LENGTH_SHORT, true); dismissSpinner(); } } // unsupported action else { mDialogHelper.toast("The app you selected is currently not supported."); } } } }
From source file:com.hybris.mobile.lib.commerce.provider.CatalogProvider.java
@Override public Uri insert(Uri uri, ContentValues values) { switch (URI_MATCHER.match(uri)) { // Insert a group link case CatalogContract.Provider.CODE_GROUP_ID: Log.i(TAG, "Saving the information for the item " + values.getAsString(CatalogContract.DataBaseDataLinkGroup.ATT_DATA_ID)); try {//from ww w. j a v a 2 s. co m mDatabaseHelper.getWritableDatabase() .insertOrThrow(CatalogContract.DataBaseDataLinkGroup.TABLE_NAME, null, values); } catch (SQLiteConstraintException e) { Log.i(TAG, "Item " + values.getAsString(CatalogContract.DataBaseDataLinkGroup.ATT_DATA_ID) + "|" + values.getAsString(CatalogContract.DataBaseDataLinkGroup.ATT_GROUP_ID) + " already exists, nothing to do"); } break; // Insert or update for the rest case CatalogContract.Provider.CODE_DATA_ID: case CatalogContract.Provider.CODE_DATA_DETAILS_ID: case CatalogContract.Provider.CODE_SYNC_GROUP: insertOrUpdate(uri, values); break; default: Log.e(TAG, "URI not recognized" + uri.toString()); throw new IllegalArgumentException("URI not recognized" + uri.toString()); } Log.i(TAG, "Notify changes for " + uri); // Notify watchers of the change getContext().getContentResolver().notifyChange(uri, null); return uri; }
From source file:com.oe.phonegap.plugins.AutoRecordVideo.java
/** * Creates a JSONObject that represents a File from the Uri * * @param data the Uri of the audio/image/video * @return a JSONObject that represents a File * @throws IOException// w w w. j ava 2s . c o m */ private JSONObject createMediaFile(Uri data) { File fp = webView.getResourceApi().mapUriToFile(data); JSONObject obj = new JSONObject(); Class webViewClass = webView.getClass(); PluginManager pm = null; try { Method gpm = webViewClass.getMethod("getPluginManager"); pm = (PluginManager) gpm.invoke(webView); } catch (NoSuchMethodException e) { } catch (IllegalAccessException e) { } catch (InvocationTargetException e) { } if (pm == null) { try { Field pmf = webViewClass.getField("pluginManager"); pm = (PluginManager) pmf.get(webView); } catch (NoSuchFieldException e) { } catch (IllegalAccessException e) { } } FileUtils filePlugin = (FileUtils) pm.getPlugin("File"); LocalFilesystemURL url = filePlugin.filesystemURLforLocalPath(fp.getAbsolutePath()); try { // File properties obj.put("name", fp.getName()); obj.put("fullPath", fp.toURI().toString()); if (url != null) { obj.put("localURL", url.toString()); } // Because of an issue with MimeTypeMap.getMimeTypeFromExtension() all .3gpp files // are reported as video/3gpp. I'm doing this hacky check of the URI to see if it // is stored in the audio or video content store. if (fp.getAbsoluteFile().toString().endsWith(".3gp") || fp.getAbsoluteFile().toString().endsWith(".3gpp")) { if (data.toString().contains("/audio/")) { obj.put("type", AUDIO_3GPP); } else { obj.put("type", VIDEO_3GPP); } } else { obj.put("type", FileHelper.getMimeType(Uri.fromFile(fp), cordova)); } obj.put("lastModifiedDate", fp.lastModified()); obj.put("size", fp.length()); } catch (JSONException e) { // this will never happen e.printStackTrace(); } return obj; }
From source file:name.zurell.kirk.apps.android.rhetolog.RhetologApplication.java
/** Data management support routines */ public Uri insertContactIntoParticipants(Uri contact, Uri session) { String[] contactProjection = { ContactsContract.Contacts.DISPLAY_NAME, ContactsContract.Contacts.PHOTO_THUMBNAIL_URI }; Cursor contactQuery = getContentResolver().query(contact, contactProjection, null, null, null); if ((contactQuery == null) || (!contactQuery.moveToFirst())) { return null; }//from w ww.j av a 2 s .com int nameCol = contactQuery.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME); int photoCol = contactQuery.getColumnIndex(ContactsContract.Contacts.PHOTO_THUMBNAIL_URI); String participantName = null; String participantPhoto = null; if (contactQuery.getType(nameCol) == Cursor.FIELD_TYPE_STRING) participantName = contactQuery.getString(nameCol); else participantName = getResources().getString(R.string.defaultParticipantCaption); if (contactQuery.getType(photoCol) == Cursor.FIELD_TYPE_STRING) { participantPhoto = contactQuery.getString(photoCol); } else { participantPhoto = "android.resource://" + this.getPackageName() + "/" + Integer.toString(R.drawable.rhetolog_participant); } contactQuery.close(); ContentValues values = new ContentValues(); values.put(RhetologContract.ParticipantsColumns.NAME, participantName); values.put(RhetologContract.ParticipantsColumns.PHOTO, participantPhoto); values.put(RhetologContract.ParticipantsColumns.LOOKUP, contact.toString()); // Learn session id, use in participants/session/id // String sessionId = session.getLastPathSegment(); // long currentSessionId; // if (sessionId.contentEquals("currentsession")) { // Bundle currentSessionBundle = getContentResolver().call(RhetologContract.PROVIDER_URI, "getCurrentSession", null, null); // currentSessionId = currentSessionBundle.getLong(RhetologContentProvider.CURRENTSESSIONEXTRA); // } else { // currentSessionId = Long.valueOf(sessionId); // } // // // Ugly, not sure how to make less so. // values.put(RhetologContract.ParticipantsColumns.SESSION, currentSessionId); Uri newParticipant = getContentResolver().insert(session, values); return newParticipant; }
From source file:com.markupartist.sthlmtraveling.provider.planner.Planner.java
public Trip2 addIntermediateStops(final Context context, Trip2 trip, JourneyQuery query) throws IOException { Uri u = Uri.parse(apiEndpoint2()); Uri.Builder b = u.buildUpon();/*w ww. j a v a 2s.com*/ b.appendEncodedPath("journey/v1/intermediate/"); b.appendQueryParameter("ident", query.ident); b.appendQueryParameter("seqnr", query.seqnr); int references = 0; String reference = null; for (SubTrip st : trip.subTrips) { if ((!TextUtils.isEmpty(st.reference)) && st.intermediateStop.isEmpty()) { b.appendQueryParameter("reference", st.reference); references++; reference = st.reference; } } u = b.build(); if (references == 0) { return trip; } HttpHelper httpHelper = HttpHelper.getInstance(context); HttpURLConnection connection = httpHelper.getConnection(u.toString()); String rawContent; int statusCode = connection.getResponseCode(); switch (statusCode) { case 200: rawContent = httpHelper.getBody(connection); try { JSONObject baseResponse = new JSONObject(rawContent); if (baseResponse.has("stops")) { if (baseResponse.isNull("stops")) { Log.d(TAG, "stops was null, ignoring."); } else if (references == 1) { JSONArray intermediateStopsJson = baseResponse.getJSONArray("stops"); for (SubTrip st : trip.subTrips) { if (reference.equals(st.reference)) { for (int i = 0; i < intermediateStopsJson.length(); i++) { st.intermediateStop .add(IntermediateStop.fromJson(intermediateStopsJson.getJSONObject(i))); } } } } else { JSONObject intermediateStopsJson = baseResponse.getJSONObject("stops"); for (SubTrip st : trip.subTrips) { if (intermediateStopsJson.has(st.reference)) { JSONArray jsonArray = intermediateStopsJson.getJSONArray(st.reference); for (int i = 0; i < jsonArray.length(); i++) { st.intermediateStop.add(IntermediateStop.fromJson(jsonArray.getJSONObject(i))); } } } } } else { Log.w(TAG, "Invalid response when fetching intermediate stops."); } } catch (JSONException e) { Log.w(TAG, "Could not parse the reponse for intermediate stops."); } break; case 400: // Bad request rawContent = httpHelper.getErrorBody(connection); try { BadResponse br = BadResponse.fromJson(new JSONObject(rawContent)); Log.e(TAG, "Invalid response for intermediate stops: " + br.toString()); } catch (JSONException e) { Log.e(TAG, "Could not parse the reponse for intermediate stops."); } default: Log.e(TAG, "Status code not OK from intermediate stops API, was " + statusCode); } return trip; }