Read image file from SD card on emulator - java

finally I managed to move some image file to the SD-card on the Android emulator. I have a task to create a application that use a grid layout to show small images, and I guess I should load the thumbnail images from the SD-card and not have the images in the res/drawable-ldpi folder in the project folder and load them from there?! I have also anmount/mount the SD-card on the emulator.
I have a lot of work to do to create this application. Is there a simple way to load on or all the images from the SD-card, just to see if it's working? Thanks!

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.

Android Studio Drawables not working

I'm trying to create an app where the header fits the entire width of the screen. I've got a Samsung Galaxy S8 Plus with a density of XXXHDPI according to Google's Device Metrics yet when I create an assets folder inside the 'res' folder named 'drawable-xxxhdpi' it doesn't load accordingly and fit the screen. Why is this? I've also tried putting it in the XHDPI and XXHDPI incase it scaled up but no. There's always a white space where the image is not scaling up.
The drawables folder has been created correctly and the XXHDPI works fine for XXHDPI devices but doesn't for bigger screens.
The white space on the right when testing on a bigger device
drawable and assets are independent directories . To load Drawable from asets you need to use Drawable.createFromStream().
Drawable d = Drawable.createFromStream(getAssets().open("images/sky.png"), null);
Other than that just make the hierarchy right and use it in conventional way. asset should be parallel to res not inside res.
Asset should be used to additional pre-bundled files not for images. because if you do this you can not provide multiple screen support.
So create Assets inside app/src/main/assets/.
And drawable inside res.
You might wanna check out these links Where should put Assets and Where should put Drawables.

How to load images in a GridView layout?

I was following the GridView tutorial http://docs.xamarin.com/guides/android/user_interface/grid_view but this tutorial only uploads the images from the Drawables folder but how can I get the user to specify a location of a folder of images on the Android device (via clicking a button) and then those images to appear in the GridView.
I am a beginner so please provide some explanation with your code so that it will help me understand easily.
This one is best choice for you https://github.com/nostra13/Android-Universal-Image-Loader
Features
Multithread image loading
Possibility of wide tuning ImageLoader's configuration (thread executors, downlaoder, decoder, memory and disc cache, display image options, and others)
Possibility of image caching in memory and/or on device's file sysytem (or SD card)
Possibility to "listen" loading process
Possibility to customize every display image call with separated options
Widget support
I have not used gridlayout but if you want to load the image
you can use the WebView (just read about the webview of android).
you can use
WebView webview=new WebView();
webView..loadDataWithBaseURL("here is your path of the image");
Try this one.
You might wanna try searching "Dynamically add images to a gridview"
Here's Clue

how to show image from server without downloading it android

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

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