I'm working on a standalone Wear app. Everything works but the image loading is too slow.
The way I'm doing it is using Firebase Storage as a back-end. I'm getting the URL and using Glide loading it into an ImageView
.
I also try using Picasso with the same result.
I tried to use the DaVinci library but its too old (3 years old). I followed this link: How to load URL image in android wear?
The code that I used is quite simple:
Picasso.get().load(imageUrl).into(iv);
and the Glide version:
Glide.with(iv.getContext()).load(imageUrl).into(iv);
The versions I'm using:
- Gradle: 3.0.1
- Google-services: 3.2.0/ 11.8.0 for the dependencies
- Glide: 4.3.1
- Picasso: 2.71828
This is the way I'm uploading the image to Firebase-Storage:
String filePath = photoFile.getAbsolutePath();
Bitmap bitmap = BitmapFactory.decodeFile(filePath, options);
mFormActivity.getContentResolver().notifyChange(photoURI, null);
int rotateImage = getCameraPhotoOrientation(filePath);
Matrix matrix = new Matrix();
matrix.postRotate(rotateImage);
Bitmap rotatedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(photoFile);
rotatedBitmap.compress(Bitmap.CompressFormat.PNG, 25, fos);
fos.close();
} catch (IOException e) {
Log.d(TAG, "fixLandscapeOrientationCamera.error = " + e.toString());
if (fos != null) {
try {
fos.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}