Not able to display JPEG image in ImageView - java

I want to display the below JPEG image in an ImageView.
Android Device is not able to decode the Image. Log Cat is showing this message: decoder->decode returned false. The image is loading correctly on PC and in chrome(Mobile). I've tried various solutions already on the StackOverflow, None of them worked. Currently, I'm displaying the image in a WebView and It's working fine.
webView.loadUrl("file:///"+Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator+"0101YC17000000000003.jpeg")
It's not an optimal solution, so I want to display the image in ImageView from the external storage.
Original Image: 0101YC17000000000003.jpeg

Related

Glide for Android: How to include GIFs from Google Drive?

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.

How to show images fast? I'm using Picasso but it is so slow. Can I show images fast like the Instagram app?

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

How to upload an image in Firebase same as WhatsApp?

I am making a chat app in which i am using RecyclerView to send images and messages, I am able to upload images in the Firebase and able to show them in RecyclerView when clicking send message button, but when i am sending the image message the image is showing in the RecyclerView after it gets uploaded because I am accessing it using a link which firebase providing the image after is gets uploaded. What i want is to show that image in the RecyclerView or i want to show a placeholder until the image gets uploaded. i am using picasso library but it is not showing placeholder until it gets uploaded. It would be great if i get progress dialogue just like whatsapp inside the image to show its progress.

How do I avoid artifacts/blurring when enlarging an image in an Android app?

I want to show this image in an Android (Java) app, but the app displays it as. How do I display the first image in an app without getting this blurring effect?
EDIT::
And how can I change the size with no blurring effect?, the imagen will show pixelated. Like this http://i.gyazo.com/18b227adb4c442b09152ca6ebc04c54c.png
To show image with the original size use layout_width="wrap_content" and layout_height="wrap_content". This is considering that your image is smaller than the screen in which it is to be shown. Also if you only provide image in your drawable-hdpi folder then the images in mdpi screen with be scaled by a predefined scale factor(possibly 2). Same case applies for other screen density. To avoid this scaling you can put your images in drawable-nodpi folder.
Note: the images you posted are not properly made(highly pixilated). Try optimizing the resolution and provide multiple resources.

Png Image support of J2ME WTK Emulator

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

Categories

Resources