I was thinking about starting a gallery app with the ability to search/filter images based on tags. My question:
I want to update the images often so... should I host the images on a webserver and host a XML file the app can call with image paths thumbnail path and tags name. That way I can load the thumbs to save bandwidth until they click and then load the main image.
XML Below:
<image>
<title>My Family</title>
<tags>family,vacation,grandpa</tags>
<thumb>myimage_thm.jpg</thumb>
<full_path>myimage.jpg</full_path>
</image>
And then use the built in android gallery?
Does this sound like the most efficient way start my project? Any thoughts would be much appreciated.
Use json instead of xml format to transfer your updates.
Implement REST interface to post updates to your server.
If you are going to download these thumbnails use Async threads to download these images. Take a look at droidfu (http://brainflush.wordpress.com/2009/11/23/droid-fu-part-2-webimageview-and-webgalleryadapter/)
Also look at the app photostream by romain guy. This should give you a good idea on how to implement your gallery app.
Related
I would like to ask advise if displaying pdf inside gridview instead of image is possible. I have tried to display list of websites in gridview using webview. Now, I want to make it a list of pdf files inside gridview. Normally same with if you open your folder in your linux laptop and have the thumbnails of your pdf, things like that. I want to achieve that in my application. I would really appreciate any of your advice, no codes needed cause i will handle it my self. I just want to have some theories. thanks and HAPPY NEW YEAR GUYS
I think what you're going to have to is convert the pdf's into a bitmap first, then load into an ImageView, check out this post and also look into other pdf rendering libraries for Android.
I'm going to be making a wallpaper app but need some guidance on how I am going to be able to store, retrieve and view the wallpapers.
Will I need to make use of ImageView so I will be able to display the images?
I'm going to need some sort of database/website to store all of the wallpapers on. What would be the best thing to do, use a database or a website?
How would I go about retrieving the wallpapers from my chosen source?
Any help/advice would be appreciated, thanks.
A common practice is to use an rss feed of images. Then, just hook up your app to the rss feed and have it check for updates periodically.
Here is a reference on reading xml (rss) in Android:
http://www.ibm.com/developerworks/opensource/library/x-android/index.html
Good luck.
you can try aquery android library for lazy loading image. this library store images in cache memory so you not need to store it externally also it will take some time for first time loading image from web but once it load in your application then it will automatically store in cache so second time take very less time to display also its less time consuming then other lazzy loading methods..below code may help you.....
AQuery aq = new AQuery(mContext);
aq.id(R.id.image1).image("http://data.whicdn.com/images/63995806/original.jpg");
You can download library from from this link
Personally I would use a database. But the easiest option would be to use the 'res/drawable' folder in android I guess.
If you stored them on the internet and haven't got connectivity, you can't get your images, so users won't necessarily like this.
To get at them from a database you'll likely have to know some SQL or know someone who knows a bit of SQL. The advantage of storing them in a database would be that it's one neat package and it is portable.
Don't worry about using ImageView it, you just need to get the image from the source (database /filesystem etc..) and give it to the imageView
I'm making an android app, here the images are getting from Cloud, is it good idea to download images and save it & use it further. Or download images every-time user uses the app, what idea you prefer is the best?
Because downloading images always is slow & its bad i know but at some point if the images are updated then how to get to know about it?
You should definitely cache your downloaded files!
Do it in your internal app directory where only you do have access to (or otherwise external storage, thats still ok).
Bandwidth and connections are always expensive and should kept low as much as possible.
So your user can see images fast even on a bad connection and your app doesn't waste his valuable bandwidth of a users data plan.
Maybe this could also help you:
https://github.com/novoda/ImageLoader
http://www.androidhive.info/2012/07/android-loading-image-from-url-http/
Make it easy on yourself and use something like Android Smart Image View. It takes care of loading and caching, and it's just about a drop-in replacement for Android's ImageView. Universal Image Loader is another alternative, more configurable, but not as quick to implement.
I used https://github.com/nostra13/Android-Universal-Image-Loader
but I think you not want only download and cache.
these no trick ,if you want check weather the image update or not, you can add metadata for image, just like md5 .
in html and browser, you can set expires header for a image:
enter link description here
but in android app, you control all yourself.
Downloading images and saving them is probably the best way to do it because you don't want to download the same images over and over. If the images are updated you can delete the older one and download the new ones. Just make sure you don't download/save a million images. Take a look at this library. It has a built-in cache on sdcard/external sd.
Downloading images from the net for display, with possible requirement of caching is a very common problem that many people have solved, you can try these solutions to see which fits you:
Ion (https://github.com/koush/ion) - very flexible and feature complete, plus it can download more than images but JSON, Strings, Files, and Java types as well. The part that I really like about this is that it can automatically cancel operations when the calling Activity finishes, so users don't waste time & bandwidth downloading images that will no longer be displayed
Universal Image Loader (https://github.com/nostra13/Android-Universal-Image-Loader) - equally capable for most use cases but for downloading/caching images only
I want to develop a gallery which can display images from various Http url's. I am downloading the image through AsyncTask. To download multiple images I have to use same AsyncTask many times for different url's. Its getting very slow. How should I proceed? Is AsyncTask need at all to download the image? Please guide me how should I go about in this app? I don't have much idea about threading.
I suggest you to refer this UniversalImageLoader to fulfill your purpose.
This Example provide a reusable instrument for asynchronous image loading, caching and displaying.
It has the same example which you are looking for(i.e. download the image from the different URL's and Set in Gallery/GridView/ListView).
Hope this helps ... :)
Hi :) I'm trying to write an android application that downloads a bunch of images and afterwads displays them in a gallery. I managed to download the images (i did download them do the data/data/project directory - not sure if that's right) but now i can't access them (i tried using the setImageURI method of the imageView to display the image after I've created an Uri instance via Uri.Builder().appendPath("data/data/project/file.jpg").build() but it was to no avail). I'm new to android developing so any help will be greatly appreciated. Thanks!
I started writing up an example, but decided that it was a waste of time since the net is littered with better examples then I could create.
At a high level, you'll need to do this:
Get 1..n File objects
Load Bitmaps from these objects using BitmapFactory
Load these decoded bitmaps into a ImageView
The typical mechanism for viewing a set of resources like this is the Adapter pattern. As I mentioned, there is a good example here which also encompasses the use of AsyncTask and some other patterns typical of Android programming which you should become familiar with. Review that and see if you have further questions.
Try:
Uri uri = Uri.parse("file:///data/data/project/file.jpg");
image.setImageURI(uri);