'How to get the name from Gitmap@ff5858 object in java
I'm trying to upload a Bitmap picture to .ASP endpoint server. The problem is that I'm using Map.Entry<String, Bitmap> that loop and obtain the file, and get the value with "entry.getValue()" method to upload to a server, the name that is obtained is android.graphics.Bitmap@ff5858. My question is: how to get only "Bitmap@" and no the entire path so, convert the "Bitmap@" to string to get the real rename. Here is how my code looks like:
for (Map.Entry<String, Bitmap> entry : mPictureInputMap.entrySet()) {
Bitmap pictureBitmap = BitmapUtils.ScaleDownBitmap(entry.getValue(),
mMaxPictureSize, JPEG_COMPRESSION_QUALITY, mCacheDir);
if(pictureBitmap != null){
String pictureName = BitmapUtils.BitMapToString(entry.getValue());
outputStream.writeBytes(String.format(CONTENT_DISPOSITION_WITH_FILE_FORMAT_STRING,
entry.getKey(), pictureName) + LINE_END);
outputStream.writeBytes(CONTENT_TYPE_HEADER_NAME + ": " + CONTENT_TYPE_HEADER_PICTURE_VALUE + LINE_END);
outputStream.writeBytes(LINE_END);
pictureBitmap.compress(Bitmap.CompressFormat.JPEG, JPEG_PICTURE_QUALITY, outputStream);
outputStream.writeBytes(LINE_END);
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
