I have a bunch of local images named image01.png ... image30.png. I want to display those images using recylceview (for better memory handling) in a fragment. I would like to use Picasso to load and resize those image.
All solutions I found is using an adapter. Can anybody suggest any easier way to impalement this without using adapter? Thanks lot in advance.
I'm guessing you want to use caching capability of Picasso to efficiently load your images.
If that is the case then why don't you use an adapter with Recycler View. Provide adapter only the name of of the images and finally inside the adapter use Picasso to load the images.
Any ViewGroup that dynamically populates its children with data from a data source like an ArrayList or a database does so using an adapter. A RecyclerView (or a ListView, GridView, ViewPager, etc.) cannot function without an adapter. If you do not want to use an adapter, use a LinearLayout inside a ScrollView.
Related
Currently I have implemented Expandable List View referencing from the following website:
http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/
Now, how do I download a jpeg from a url(e.e. h--p://www.test.com/image.jpg) and display this image within each list child when that list child is chosen? Currently it only shows data.
The reason is being, I don't want to download the images and store within the assets folder which will increase the size of the application, that's why use url to show only when that list child is chosen.
Is it possible? Or I could only do so by downloading the image beforehand and storing under assets?
Yes it is possible. If you want to implement this then you should grab a lazy loading library. For that you may use aquery just google it, its a nice library to provide the required mechanism.
Also Expandable istview is nothing but a listview so whatever you want to do inside a listviewcan be done within ExpandableListView as well.
I have created five Horizontal ListView with images and texts in one activity. Using Lazy loading of images concept it is working fine. Now when it is offline, the list is showing blank,ie., no data . I need to implement memory-caching concept, such that when it is offline it will be showing the previous session datas(images & texts).
In oncreate: I am calling the Asynctask. In doinbackground method of asynctask,I am consuming Webservices containing images & texts,then I am passing those datas to the adapter. And in postexecute, I am setting my adapter to Listview.
In adapter class: getview method I am setting the texts and loading the images using lazy loading.
Please help me to get rid of this. Thanks in advance
You should store text etc. in an SQLiteDatabase and store your Images on external storage.
I have to load 3 imageviews per row in my application. I need to do this dynamically through an adapter class. What is the best way of doing this? Which layout should I use?
Use Lazy Loading Listview for that, Below both links for that and change into XML file and set Three(3) Imageview instead of One(1) Textview and One(1) Imageview.
Lazy Loading Listview
Universal ImageLoader
I am using a GridView having image as child items.
The getView functions loads a default image from the application "Loading.gif" for all the child items.
In another thread I load all the images to some Bitmap type into the adapter.
Is it wise enough to call adapter.notifyDataSetChanged() after each image is loaded ?
Or is there and alternative way to directly update the image ?
Checkout the technique used in ListView , where default image used in listview items. And a thread load images for list items and update the new images without adapter.notifyDataSetChanged() called.
http://iamvijayakumar.blogspot.com/2011/06/android-lazy-image-loader-example.html
If you want more efficient way to do this then check this out.
http://developer.android.com/resources/samples/XmlAdapters/src/com/example/android/xmladapters/ImageDownloader.html
using listview i want to view the images in list. each row has one image
I would to the following:
Write a custom ArrayAdapter for the Listview
pass an Array of Images or ImageURLs to you Adapter
Inflate the ListViewRows with you custom implementation - hence an image
I would recommend http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/
As a starting point. Since you are not giving additional information, there is not much more to do for me - except writing the code for you....