Picasso not loading JPG format - android

I'm getting some images from api and showing them via picasso library. Unfortunately it isn't showing .JPG formatted images while it perfectly works with jpg images. Is there anyone who had such problem? Is there any cure or we can't use picasso with JPG?

If I remember well, I had the same problem in general with android studio, so this doesn't regard strictly Picasso library. What I know is that in a case (.jpg) those files are recognized as multimedia files (so treated that way) in the opposite case (.JPG) they are considered as files and treated more generally.
Usually I convert all .PNG into .png and all .JPG into .jpg.
Hope it can help you!

Related

Android encode animated webp

I tried many things so far, is here anyone who knows how I can encode a animated webp file?
I tried to rename a gif into a webp file (sometimes this helps) but that doesn't convert it. I need a real animated webp file.
Thanks in advance

Image loading from server

Which is the fastest and best way to get image from server in android
app.
1. Image url
2. base64 format
or any other format which load image very quick as on normal internet speed.
As mentioned here base64 format is %37 larger than normal image. So if you use base64 format, you will have larger image and longer download time. In this case, you need to use normal image url.
To download images as fast as possible, you can use Picasso or Glide.
Just use glide for faster image load in your application because glide uses caching of images and it loads an image after compressing it a little bit. Even Google recommend this library to developers , Google used this library in Gmail.

Should I compress a Bitmap before POSTing it to a server?

I have a question regarding best practices for this. If I am doing a multi part request to a server, should I compress the .jpg file (assuming the .jpg file is large) I would be POSTing to the API on the client (Android) side?
Or is this usually not a problem since .jpg handles lossy compression already?
Instead of compressing, you may want to resize it instead. Take a look at createScaledBitmap.
Jpg is already a compressed format Compressing a jpg file might even result in a larger file.

Picasso load image into GifImageView (android-gif-drawable library)

I am using the android-gif-drawable library to display an animated gif in an Android view. This library can load a file from an input stream, byte array, byte buffer, or from a locally stored file. I am looking for a way to use Picasso to download the gif and pass it to the library to load into the GifImageView. Unfortunately, once the downloaded image is converted to a Bitmap, it just becomes a single frame. I'm thinking a custom request handler might be able to hand off an input stream for the GifImageView to load, but I cannot seem to figure out the syntax to do this. Does anyone have pointers or thoughts on doing this?
If you haven't figured it out yet, you can use the library Ion. I was facing the same problem a few days ago, and it worked for me.

Handling lots of drawables in android project

I am beginner in Android development. I need to show 400+ images in my android app. Right now I am putting all of them in my drawable folder, but this doesn't seem good, as my apk becomes too large in size. What should I do? Can I play with images' resolution and all? Please help.
best solution will be to put them in web and then displaying it through lazy list, But if thats not an option then only thing you can do is to compress your image to a extent it is acceptable, that will check you problem of large apk size.
try PNGOUT , a great tool for compressing images.
Put them all in a extension-obb-File:
http://developer.android.com/google/play/expansion-files.html
So I handled it with videos.

Categories

Resources