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
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 am building an app in Android Studio and I have a problem. The basic idea of the app contains one Relative_layout with two buttons inside.Every time I press one button it sets the background of the layout to a Random image I have stored in the "res/drawable folder". The thing is that I am going to have a very big amount(larger than 10.000) of pictures(with high resolution) to be stored in that folder. Will this have a big effect on the APK size of the app? And if it does, is there any other more efficient way to store(or connect) a large amount of pictures with an android app?
You have 3 options:
Store the images as local resources, with very high res: Your application size will be huge
Stroe the images as local resources, but with less resolution: Your application size will be smaller
Store all the images on a web server, and retrieve them when you need it(Using picasso is super easy): Your application size will be very small.
You decide.
if the number of images is large, it is better to store at server and load dynamically when required, use Glide(fast and efficient open source media management and image loading framework), you can load image and display with a single line of code.
How would you approach this problem:
My app should download different packages of pictures (containing up to 300 pngs, each about 20 kb) and store the pictures on the phone, so i can display them.
I want to upload the pictures somewhere online, so I can change them every time and the user can enjoy the newest pictures. (I upload the pictures not with the app)
I read that storing them in a sqlite db isn't the best option.
At the moment I am storing the pictures in the app, but then I don't know how I can upload and replace pictures on all apps immediately without the need of updating the whole app.
I don't need code or stuff, so don't waste your precious time on that, just some general hints where and how you would store the pictures online, and how android can download the pictures easily.
Take a look at the Glide or Picasso libraries. Those are super easy to use for thread-safe downloading of images.
Personally, I just fetch/store the images on imgur.
If you want to upload a dedicated databse, you'll have to set one up. Some common ones are Amazon, Google, etc. There are tons.
Have a look at this answer. In this answer Picasso library is used to handle image download. Picasso gets rid of a lot of coding and testing to handle image download.
In a project that I am working on, we use Amazon S3 to store our pictures, it's very reliable and is one of the goto solutions right now.
From what I heard Snapchat and some other big firms use S3 to store their picture!
It's also very cheap, plus I believe they have free hosting to a certain degree.
This is their API guide for android.
We use a service called File Picker to handle upload and download from amazonS3, it reduces a lot of work, but I don't think it's a free service.
You can use Picasso for downloading images from network in Android. For storing images Amazon S3 or Google cloud storage can be your options.
Not sure if downloading packages is better than downloading individual pictures (archiving won't save you much space).
As for your question, you can make some kind of API you will query from your app, even a flat file hosted somewhere with changing content would work. Your app could check it periodically for the new address to download pictures from (assuming it will change).
another way is using push messages - sending out a push through GCM that your apps will receive that will notify them about new content available. It would even work when the app is closed.
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" :)
The title speaks for itself really. I was wondering if there is some simple way (similar to opening the Photo Gallery) to select an image in Google Images and then passing it back to an ImageView for Android?
Has anyone done this?
It's a fairly commong task within android. You can take a look to the following tutorial to accomplish exactly what you need.
http://viralpatel.net/blogs/pick-image-from-galary-android-app/
Good luck!