List of usage examples for android.net Uri withAppendedPath
public static Uri withAppendedPath(Uri baseUri, String pathSegment)
From source file:com.karura.framework.plugins.utils.ContactAccessorSdk5.java
/** * Create a ContactField JSONObject// w ww .j av a 2s . co m * * @param contactId * @return a JSONObject representing a ContactField */ private JSONObject photoQuery(Cursor cursor, String contactId) { JSONObject photo = new JSONObject(); try { photo.put("id", cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Photo._ID))); photo.put("pref", false); photo.put("type", "url"); Uri person = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, (new Long(contactId))); Uri photoUri = Uri.withAppendedPath(person, ContactsContract.Contacts.Photo.CONTENT_DIRECTORY); photo.put("value", photoUri.toString()); } catch (JSONException e) { Log.e(LOG_TAG, e.getMessage(), e); } return photo; }
From source file:com.owncloud.android.datamodel.FileDataStorageManager.java
private Vector<OCFile> getFolderContent(long parentId/*, boolean onlyOnDevice*/) { Vector<OCFile> ret = new Vector<OCFile>(); Uri req_uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_DIR, String.valueOf(parentId)); Cursor c = null;//from www .jav a 2 s .c om if (getContentProviderClient() != null) { try { c = getContentProviderClient().query(req_uri, null, ProviderTableMeta.FILE_PARENT + "=?", new String[] { String.valueOf(parentId) }, null); } catch (RemoteException e) { Log_OC.e(TAG, e.getMessage()); return ret; } } else { c = getContentResolver().query(req_uri, null, ProviderTableMeta.FILE_PARENT + "=?", new String[] { String.valueOf(parentId) }, null); } if (c != null) { if (c.moveToFirst()) { do { OCFile child = createFileInstance(c); // TODO Enable when "On Device" is recovered ? // if (child.isFolder() || !onlyOnDevice || onlyOnDevice && child.isDown()){ ret.add(child); // } } while (c.moveToNext()); } c.close(); } Collections.sort(ret); return ret; }
From source file:com.android.gallery3d.filtershow.FilterShowActivity.java
private Intent getDefaultShareIntent() { Intent intent = new Intent(Intent.ACTION_SEND); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.setType(SharedImageProvider.MIME_TYPE); mSharedOutputFile = SaveImage.getNewFile(this, MasterImage.getImage().getUri()); Uri uri = Uri.withAppendedPath(SharedImageProvider.CONTENT_URI, Uri.encode(mSharedOutputFile.getAbsolutePath())); intent.putExtra(Intent.EXTRA_STREAM, uri); return intent; }
From source file:com.dsdar.thosearoundme.util.ContactsListFragment.java
/** * Decodes and scales a contact's image from a file pointed to by a Uri in * the contact's data, and returns the result as a Bitmap. The column that * contains the Uri varies according to the platform version. * //from w ww .j a v a2 s . co m * @param photoData * For platforms prior to Android 3.0, provide the Contact._ID * column value. For Android 3.0 and later, provide the * Contact.PHOTO_THUMBNAIL_URI value. * @param imageSize * The desired target width and height of the output image in * pixels. * @return A Bitmap containing the contact's image, resized to fit the * provided image size. If no thumbnail exists, returns null. */ private Bitmap loadContactPhotoThumbnail(String photoData, int imageSize) { // Ensures the Fragment is still added to an activity. As this method is // called in a // background thread, there's the possibility the Fragment is no longer // attached and // added to an activity. If so, no need to spend resources loading the // contact photo. if (!isAdded() || getActivity() == null) { return null; } // Instantiates an AssetFileDescriptor. Given a content Uri pointing to // an image file, the // ContentResolver can return an AssetFileDescriptor for the file. AssetFileDescriptor afd = null; // This "try" block catches an Exception if the file descriptor returned // from the Contacts // Provider doesn't point to an existing file. try { Uri thumbUri; // If Android 3.0 or later, converts the Uri passed as a string to a // Uri object. if (Util.hasHoneycomb()) { thumbUri = Uri.parse(photoData); } else { // For versions prior to Android 3.0, appends the string // argument to the content // Uri for the Contacts table. final Uri contactUri = Uri.withAppendedPath(Contacts.CONTENT_URI, photoData); // Appends the content Uri for the Contacts.Photo table to the // previously // constructed contact Uri to yield a content URI for the // thumbnail image thumbUri = Uri.withAppendedPath(contactUri, Photo.CONTENT_DIRECTORY); } // Retrieves a file descriptor from the Contacts Provider. To learn // more about this // feature, read the reference documentation for // ContentResolver#openAssetFileDescriptor. afd = getActivity().getContentResolver().openAssetFileDescriptor(thumbUri, "r"); // Gets a FileDescriptor from the AssetFileDescriptor. A // BitmapFactory object can // decode the contents of a file pointed to by a FileDescriptor into // a Bitmap. FileDescriptor fileDescriptor = afd.getFileDescriptor(); if (fileDescriptor != null) { // Decodes a Bitmap from the image pointed to by the // FileDescriptor, and scales it // to the specified width and height return ImageLoader.decodeSampledBitmapFromDescriptor(fileDescriptor, imageSize, imageSize); } } catch (FileNotFoundException e) { // If the file pointed to by the thumbnail URI doesn't exist, or the // file can't be // opened in "read" mode, ContentResolver.openAssetFileDescriptor // throws a // FileNotFoundException. if (BuildConfig.DEBUG) { Log.d(TAG, "Contact photo thumbnail not found for contact " + photoData + ": " + e.toString()); } } finally { // If an AssetFileDescriptor was returned, try to close it if (afd != null) { try { afd.close(); } catch (IOException e) { // Closing a file descriptor might cause an IOException if // the file is // already closed. Nothing extra is needed to handle this. } } } // If the decoding failed, returns null return null; }
From source file:com.android.mms.transaction.MessagingNotification.java
private static final void addSmsNotificationInfos(Context context, Set<Long> threads, SortedSet<NotificationInfo> notificationSet) { ContentResolver resolver = context.getContentResolver(); Cursor cursor = SqliteWrapper.query(context, resolver, Sms.CONTENT_URI, SMS_STATUS_PROJECTION, NEW_INCOMING_SM_CONSTRAINT, null, Sms.DATE + " desc"); if (cursor == null) { return;/* w ww . ja v a2s . com*/ } try { while (cursor.moveToNext()) { String address = cursor.getString(COLUMN_SMS_ADDRESS); if (MessageUtils.isWapPushNumber(address)) { String[] mAddresses = address.split(":"); address = mAddresses[context.getResources().getInteger(R.integer.wap_push_address_index)]; } Contact contact = Contact.get(address, false); if (contact.getSendToVoicemail()) { // don't notify, skip this one continue; } String message = cursor.getString(COLUMN_SMS_BODY); long threadId = cursor.getLong(COLUMN_SMS_THREAD_ID); long timeMillis = cursor.getLong(COLUMN_SMS_DATE); int subId = cursor.getInt(COLUMN_SMS_SUB_ID); String msgId = cursor.getString(COLUMN_SMS_ID); if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) { Log.d(TAG, "addSmsNotificationInfos: count=" + cursor.getCount() + ", addr=" + address + ", thread_id=" + threadId); } NotificationInfo info = getNewMessageNotificationInfo(context, true /* isSms */, address, message, null /* subject */, threadId, subId, timeMillis, null /* attachmentBitmap */, contact, WorkingMessage.TEXT); if (MessageUtils.isMailboxMode()) { info.mClickIntent.setData(Uri.withAppendedPath(Sms.CONTENT_URI, msgId)); } notificationSet.add(info); threads.add(threadId); threads.add(cursor.getLong(COLUMN_SMS_THREAD_ID)); } } finally { cursor.close(); } }
From source file:com.android.providers.contacts.ContactsSyncAdapter.java
protected static void updateProviderWithContactEntry(String account, Long syncLocalId, ContactEntry entry, ContentProvider provider) throws ParseException { final String name = entry.getTitle(); final String notes = entry.getContent(); final String yomiName = entry.getYomiName(); final String personSyncId = lastItemFromUri(entry.getId()); final String personSyncVersion = lastItemFromUri(entry.getEditUri()); // Store the info about the person ContentValues values = new ContentValues(); values.put(People.NAME, name);/* w ww . j a va2 s . c o m*/ values.put(People.NOTES, notes); values.put(People.PHONETIC_NAME, yomiName); values.put(SyncConstValue._SYNC_ACCOUNT, account); values.put(SyncConstValue._SYNC_ID, personSyncId); values.put(SyncConstValue._SYNC_DIRTY, "0"); values.put(SyncConstValue._SYNC_LOCAL_ID, syncLocalId); values.put(SyncConstValue._SYNC_TIME, personSyncVersion); values.put(SyncConstValue._SYNC_VERSION, personSyncVersion); Uri personUri = provider.insert(People.CONTENT_URI, values); // Store the photo information final boolean photoExistsOnServer = !TextUtils.isEmpty(entry.getLinkPhotoHref()); final String photoVersion = lastItemFromUri(entry.getLinkEditPhotoHref()); values.clear(); values.put(Photos.PERSON_ID, ContentUris.parseId(personUri)); values.put(Photos.EXISTS_ON_SERVER, photoExistsOnServer ? 1 : 0); values.put(SyncConstValue._SYNC_ACCOUNT, account); values.put(SyncConstValue._SYNC_ID, personSyncId); values.put(SyncConstValue._SYNC_DIRTY, 0); values.put(SyncConstValue._SYNC_LOCAL_ID, syncLocalId); values.put(SyncConstValue._SYNC_TIME, photoVersion); values.put(SyncConstValue._SYNC_VERSION, photoVersion); if (provider.insert(Photos.CONTENT_URI, values) == null) { Log.e(TAG, "error inserting photo row, " + values); } // Store each email address for (Object object : entry.getEmailAddresses()) { EmailAddress email = (EmailAddress) object; values.clear(); contactsElementToValues(values, email, ENTRY_TYPE_TO_PROVIDER_EMAIL); values.put(ContactMethods.DATA, email.getAddress()); values.put(ContactMethods.KIND, Contacts.KIND_EMAIL); Uri uri = Uri.withAppendedPath(personUri, People.ContactMethods.CONTENT_DIRECTORY); provider.insert(uri, values); } // Store each postal address for (Object object : entry.getPostalAddresses()) { PostalAddress address = (PostalAddress) object; values.clear(); contactsElementToValues(values, address, ENTRY_TYPE_TO_PROVIDER_POSTAL); values.put(ContactMethods.DATA, address.getValue()); values.put(ContactMethods.KIND, Contacts.KIND_POSTAL); Uri uri = Uri.withAppendedPath(personUri, People.ContactMethods.CONTENT_DIRECTORY); provider.insert(uri, values); } // Store each im address for (Object object : entry.getImAddresses()) { ImAddress address = (ImAddress) object; values.clear(); contactsElementToValues(values, address, ENTRY_TYPE_TO_PROVIDER_IM); values.put(ContactMethods.DATA, address.getAddress()); values.put(ContactMethods.KIND, Contacts.KIND_IM); final byte protocolType = address.getProtocolPredefined(); if (protocolType == ImAddress.PROTOCOL_NONE) { // don't add anything } else if (protocolType == ImAddress.PROTOCOL_CUSTOM) { values.put(ContactMethods.AUX_DATA, ContactMethods.encodeCustomImProtocol(address.getProtocolCustom())); } else { Integer providerProtocolType = ENTRY_IM_PROTOCOL_TO_PROVIDER_PROTOCOL.get(protocolType); if (providerProtocolType == null) { throw new IllegalArgumentException("unknown protocol type, " + protocolType); } values.put(ContactMethods.AUX_DATA, ContactMethods.encodePredefinedImProtocol(providerProtocolType)); } Uri uri = Uri.withAppendedPath(personUri, People.ContactMethods.CONTENT_DIRECTORY); provider.insert(uri, values); } // Store each organization for (Object object : entry.getOrganizations()) { Organization organization = (Organization) object; values.clear(); contactsElementToValues(values, organization, ENTRY_TYPE_TO_PROVIDER_ORGANIZATION); values.put(Organizations.COMPANY, organization.getName()); values.put(Organizations.TITLE, organization.getTitle()); values.put(Organizations.COMPANY, organization.getName()); Uri uri = Uri.withAppendedPath(personUri, Organizations.CONTENT_DIRECTORY); provider.insert(uri, values); } // Store each group for (Object object : entry.getGroups()) { GroupMembershipInfo groupMembershipInfo = (GroupMembershipInfo) object; if (groupMembershipInfo.isDeleted()) { continue; } values.clear(); values.put(GroupMembership.GROUP_SYNC_ACCOUNT, account); values.put(GroupMembership.GROUP_SYNC_ID, lastItemFromUri(groupMembershipInfo.getGroup())); Uri uri = Uri.withAppendedPath(personUri, GroupMembership.CONTENT_DIRECTORY); provider.insert(uri, values); } // Store each phone number for (Object object : entry.getPhoneNumbers()) { PhoneNumber phone = (PhoneNumber) object; values.clear(); contactsElementToValues(values, phone, ENTRY_TYPE_TO_PROVIDER_PHONE); values.put(People.Phones.NUMBER, phone.getPhoneNumber()); values.put(People.Phones.LABEL, phone.getLabel()); Uri uri = Uri.withAppendedPath(personUri, People.Phones.CONTENT_DIRECTORY); provider.insert(uri, values); } // Store the extended properties for (Object object : entry.getExtendedProperties()) { ExtendedProperty extendedProperty = (ExtendedProperty) object; if (!"android".equals(extendedProperty.getName())) { continue; } JSONObject jsonObject = null; try { jsonObject = new JSONObject(extendedProperty.getXmlBlob()); } catch (JSONException e) { Log.w(TAG, "error parsing the android extended property, dropping, entry is " + entry.toString()); continue; } Iterator jsonIterator = jsonObject.keys(); while (jsonIterator.hasNext()) { String key = (String) jsonIterator.next(); values.clear(); values.put(Extensions.NAME, key); try { values.put(Extensions.VALUE, jsonObject.getString(key)); } catch (JSONException e) { // this should never happen, since we just got the key from the iterator } Uri uri = Uri.withAppendedPath(personUri, People.Extensions.CONTENT_DIRECTORY); if (null == provider.insert(uri, values)) { Log.e(TAG, "Error inserting extension into provider, uri " + uri + ", values " + values); } } break; } }
From source file:nl.sogeti.android.gpstracker.viewer.LoggerMap.java
private void createListeners() { mFab.setOnClickListener(new View.OnClickListener() { @Override/*from w ww . j a va2 s .com*/ public void onClick(View v) { Intent intent = new Intent(LoggerMap.this, ControlTracking.class); startActivityForResult(intent, MENU_TRACKING); } }); /******************************************************* * 8 Runnable listener actions */ speedCalculator = new Runnable() { @Override public void run() { double avgspeed = 0.0; ContentResolver resolver = LoggerMap.this.getContentResolver(); Cursor waypointsCursor = null; try { waypointsCursor = resolver.query( Uri.withAppendedPath(Tracks.CONTENT_URI, LoggerMap.this.mTrackId + "/waypoints"), new String[] { "avg(" + Waypoints.SPEED + ")", "max(" + Waypoints.SPEED + ")" }, null, null, null); if (waypointsCursor != null && waypointsCursor.moveToLast()) { double average = waypointsCursor.getDouble(0); double maxBasedAverage = waypointsCursor.getDouble(1) / 2; avgspeed = Math.min(average, maxBasedAverage); } if (avgspeed < 2) { avgspeed = 5.55d / 2; } } finally { if (waypointsCursor != null) { waypointsCursor.close(); } } mAverageSpeed = avgspeed; runOnUiThread(new Runnable() { @Override public void run() { updateSpeedColoring(); } }); } }; mServiceConnected = new Runnable() { @Override public void run() { updateBlankingBehavior(); } }; /******************************************************* * 8 Various dialog listeners */ mNoteSelectDialogListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Uri selected = (Uri) mGallery.getSelectedItem(); SegmentOverlay.handleMedia(LoggerMap.this, selected); } }; mGroupCheckedChangeListener = new android.widget.RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.layer_google_satellite: setSatelliteOverlay(true); break; case R.id.layer_google_regular: setSatelliteOverlay(false); break; default: break; } } }; mCheckedChangeListener = new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { int checkedId; checkedId = buttonView.getId(); switch (checkedId) { case R.id.layer_traffic: setTrafficOverlay(isChecked); break; case R.id.layer_speed: setSpeedOverlay(isChecked); break; case R.id.layer_altitude: setAltitudeOverlay(isChecked); break; case R.id.layer_distance: setDistanceOverlay(isChecked); break; case R.id.layer_compass: setCompassOverlay(isChecked); break; case R.id.layer_location: setLocationOverlay(isChecked); break; default: break; } } }; mNoTrackDialogListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Log.d( TAG, "mNoTrackDialogListener" + which); Intent tracklistIntent = new Intent(LoggerMap.this, TrackList.class); tracklistIntent.putExtra(Tracks._ID, LoggerMap.this.mTrackId); startActivityForResult(tracklistIntent, MENU_TRACKLIST); } }; /** * Listeners to events outside this mapview */ mSharedPreferenceChangeListener = new OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (key.equals(Constants.TRACKCOLORING)) { mAverageSpeed = 0.0; updateSpeedColoring(); } else if (key.equals(Constants.DISABLEBLANKING) || key.equals(Constants.DISABLEDIMMING)) { updateBlankingBehavior(); } else if (key.equals(Constants.SPEED)) { updateSpeedDisplayVisibility(); } else if (key.equals(Constants.ALTITUDE)) { updateAltitudeDisplayVisibility(); } else if (key.equals(Constants.DISTANCE)) { updateDistanceDisplayVisibility(); } else if (key.equals(Constants.COMPASS)) { updateCompassDisplayVisibility(); } else if (key.equals(Constants.TRAFFIC)) { updateGoogleOverlays(); } else if (key.equals(Constants.SATELLITE)) { updateGoogleOverlays(); } else if (key.equals(Constants.LOCATION)) { updateLocationDisplayVisibility(); } } }; mTrackMediasObserver = new ContentObserver(new Handler()) { @Override public void onChange(boolean selfUpdate) { if (!selfUpdate) { if (mLastSegmentOverlay != null) { mLastSegmentOverlay.calculateMedia(); mMapView.postInvalidate(); } } else { Log.w(this, "mTrackMediasObserver skipping change on " + mLastSegment); } } }; mTrackSegmentsObserver = new ContentObserver(new Handler()) { @Override public void onChange(boolean selfUpdate) { if (!selfUpdate) { LoggerMap.this.updateDataOverlays(); } else { Log.w(this, "mTrackSegmentsObserver skipping change on " + mLastSegment); } } }; mSegmentWaypointsObserver = new ContentObserver(new Handler()) { @Override public void onChange(boolean selfUpdate) { if (!selfUpdate) { LoggerMap.this.updateTrackNumbers(); if (mLastSegmentOverlay != null) { moveActiveViewWindow(); } else { Log.e(this, "Error the last segment changed but it is not on screen! " + mLastSegment); } } else { Log.w(this, "mSegmentWaypointsObserver skipping change on " + mLastSegment); } } }; mUnitsChangeListener = new UnitsI18n.UnitsChangeListener() { @Override public void onUnitsChange() { mAverageSpeed = 0.0; updateTrackNumbers(); updateSpeedColoring(); } }; }
From source file:com.remobile.contacts.ContactAccessorSdk5.java
/** * Create a ContactField JSONObject//from w w w .ja v a 2 s . c o m * @param contactId * @return a JSONObject representing a ContactField */ private JSONObject photoQuery(Cursor cursor, String contactId) { JSONObject photo = new JSONObject(); try { photo.put("id", cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Photo._ID))); photo.put("pref", false); photo.put("type", "url"); Uri person = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, (Long.valueOf(contactId))); Uri photoUri = Uri.withAppendedPath(person, ContactsContract.Contacts.Photo.CONTENT_DIRECTORY); photo.put("value", photoUri.toString()); // Query photo existance Cursor photoCursor = mApp.getActivity().getContentResolver().query(photoUri, new String[] { ContactsContract.Contacts.Photo.PHOTO }, null, null, null); if (photoCursor == null) { return null; } else { if (!photoCursor.moveToFirst()) { photoCursor.close(); return null; } } } catch (JSONException e) { Log.e(LOG_TAG, e.getMessage(), e); } return photo; }
From source file:com.android.contacts.list.DefaultContactBrowseListFragment.java
/** * Share all contacts that are currently selected. This method is pretty inefficient for * handling large numbers of contacts. I don't expect this to be a problem. *///from w ww . jav a 2 s .c o m private void shareSelectedContacts() { final StringBuilder uriListBuilder = new StringBuilder(); for (Long contactId : getSelectedContactIds()) { final Uri contactUri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, contactId); final Uri lookupUri = ContactsContract.Contacts.getLookupUri(getContext().getContentResolver(), contactUri); if (lookupUri == null) { continue; } final List<String> pathSegments = lookupUri.getPathSegments(); if (pathSegments.size() < 2) { continue; } final String lookupKey = pathSegments.get(pathSegments.size() - 2); if (uriListBuilder.length() > 0) { uriListBuilder.append(':'); } uriListBuilder.append(Uri.encode(lookupKey)); } if (uriListBuilder.length() == 0) { return; } final Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_MULTI_VCARD_URI, Uri.encode(uriListBuilder.toString())); final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType(ContactsContract.Contacts.CONTENT_VCARD_TYPE); intent.putExtra(Intent.EXTRA_STREAM, uri); try { startActivityForResult(Intent.createChooser(intent, getResources() .getQuantityString(R.plurals.title_share_via, /* quantity */ getSelectedContactIds().size())), ACTIVITY_REQUEST_CODE_SHARE); } catch (final ActivityNotFoundException ex) { Toast.makeText(getContext(), R.string.share_error, Toast.LENGTH_SHORT).show(); } }
From source file:org.smilec.smile.student.CourseList.java
private Bitmap getBitmapFromCameraResult() { long id = -1; _act = this;//w w w . ja va2s .c o m // 1. Get Original id using m_cursor try { String[] proj = { MediaStore.Images.Media._ID }; mcursor_for_camera = _act.managedQuery(imageUri, proj, // Which // columns // to return null, // WHERE clause; which rows to return (all rows) null, // WHERE clause selection arguments (none) null);// Order-by clause (ascending by name) int id_ColumnIndex = mcursor_for_camera.getColumnIndexOrThrow(MediaStore.Images.Media._ID); if (mcursor_for_camera.moveToFirst()) { id = mcursor_for_camera.getLong(id_ColumnIndex); } else { return null; } } finally { if (mcursor_for_camera != null) { mcursor_for_camera.close(); } } // 2. get Bitmap Bitmap b = null; try { Bitmap c = MediaStore.Images.Media.getBitmap(_act.getContentResolver(), Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id + "")); Log.d(APP_TAG, "Height" + c.getHeight() + " width= " + c.getWidth()); // resize bitmap: code copied from // thinkandroid.wordpress.com/2009/12/25/resizing-a-bitmap/ int target_width = 640; // 800, 360 int target_height = 480; // 600, 240 int w = c.getWidth(); int h = c.getHeight(); if ((w > target_width) || (h > target_height)) { b = Bitmap.createScaledBitmap(c, target_width, target_height, false); } else { b = c; } } catch (FileNotFoundException e) { Log.d(APP_TAG, "ERROR" + e); } catch (IOException e) { Log.d(APP_TAG, "ERROR" + e); } return b; }