I am trying to include GIFs in my android application. My GIFs are shared as a document on Google Drive with public access enabled. Currently, I'm trying to use Glide to include the GIFs.
Glide.with(parent.getContext())
.asGif()
.load("https://drive.google.com/uc?id=1-QKgZ76K3EZQlbXyY3wI57FA8k31JmrA")
.into(imageView);
However, although there is no error, the GIF does not display on my phone, even after a long time(internet issues shouldn't be the problem).
It appears that this is only a problem for GIFs on google drive. Trying to show an internet GIF such as this one works on my Android phone.
How can I show GIF files on Google Drive with Glide on my Android device?
It should work. Because Glide trying to fetch image which type you specified. I just tried it and its work. it loads too late. If you wait a bit, you will see that it can be loaded. You can test it more easily if you upload a lower resolution gif file to Drive.
Related
I just want new method for fast image upload. Can you tell us the best way for you to know? I want the images to be loaded at the same time as xml. :)
Well, image loading and rendering is time & resource consuming process. Rendering image and then displaying faster can depend on multiple factors :
Image resolution
Image size
Network strength
Android device
Algorithm used by Library for rendering
Hence, you should consider above mentioned points for image rendering on Android device.
Moreover, if you are unsatisfied with Picasso library you can try Glide
It is one of the most efficient libraries available in the market today.
Or you can also use Fresco
In addition to using these libraries, you can also improve your codebase for image loading by following below mentioned points:
Save images or image urls to your local cache directory and avoid making API call each time for loading an image. You should only make API call if imageurl has been modified in the API response.
Show proper placeholder image in case of error in image loading/rendering.
Show proper default placeholder image when image is unavailable/missing.
Use proper images resolutions. Like if you have to show a thumbnail image, then you should show thumbnail image and not full resolution image. Multiple resolutions for an image can be can be thumb, low, normal, high and they should have separate urls.
Use compressed images.
Blur thumbnail image before loading actual image.
Glide is very good about it. However, because the event shows shape according to the size and intensity of the photo, it will be healthier for you to optimize it on the backend side.
You can read about it here: Glide Vs Picasso
I need to access images from phone's gallery and then perform image recognition like what all elements are there in the images(watch,food etc etc). Can this be done using opencv library's on device sdk for android. I am not getting any clue about this.
I have found a lot of examples like this:
how to Capture screen in android and covert it to image
I need to capture an screenshot of screen activity, but I'm developing an external library, so I can't get current activity of the application to get the View and then flush the bitmap into canvas. Is there another way to capture a screenshot?
If you are trying to save the image from Snapchat, you need to save the Bitmap in another way.
With a rooted phone you can access the apps storage and copy the image while the app shows it.
That way the app wont notice you took a "Screenshot" :)
I am building an Android app that will show images - based on exact GPS location.
My idea is to show these images from server without downloading them to phone. That way you can view them only if you have downloaded that app and have internet access.
Is it possible in Android??
YEs.. You can load them in a webview:
http://developer.android.com/reference/android/webkit/WebView.html
I use a png image in my project that is not displayed in emulator but it can be displayed in phone. Then i open it with photoshop, save as png and use that image. It is displayed both emulator and phone. I couldn't figure out the difference of original and edited one. And is there any setting of emulator for image display? And how can i understand any png file is supported or not?
original image
edited image
I preferred PNG files is good for MIDP. You can check following links, It will helps you.
What image types does MIDP support?
Image Formats in J2ME