Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Android Example Download Images From Web And Lazy Load In ListView



In this example downloading images from web to a Listview. Using lazy loading to download images in a listview. Using custom adapter to create lisview rows and using ImageLoader class to Lazy Load Images from web and show in listview row. Click on listview showing image url in alert.

Steps :

    MainActivity.java : Initialize static image url in string array and create listview.
    LazyImageLoadAdapter.java : Used to create each list row. Inflate tabitem.xml file for each row and call ImageLoader.java to download image from url and resize downloaded image cache on sdcard.
    ImageLoader.java : Used to download image from url and resize downloaded image and make file cache on sdcard. Lazy load images for listview rows.
    FileCache.java : Used to create folder at sdcard and create map to store downloaded image information.
    MemoryCache.java : Used to set cache folder size limit ( How much mb/kb downloaded image cache folder will store ) and also used to clear cache files from sdcard.
    Utils.java : Used to Create Cache image for images downloaded from web.

Example Flow :




Project Structure :



File : AndroidManifest.xml


- Define android.permission.WRITE_EXTERNAL_STORAGE and android.permission.INTERNET permissions.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.androidexample.lazyimagedownload"
      android:versionCode="1"
      android:versionName="1.0"
      debuggable="true">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name="com.androidexample.lazyimagedownload.MainActivity"
                  android:label="@string/app_name"
                  android:configChanges="keyboardHidden|orientation">
     


This post first appeared on Android And Java Solution, please read the originial post: here

Share the post

Android Example Download Images From Web And Lazy Load In ListView

×

Subscribe to Android And Java Solution

Get updates delivered right to your inbox!

Thank you for your subscription

×