Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7044105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:22:11+00:00 2026-05-28T02:22:11+00:00

I used Lazy Loader to load image in my listView and the image is

  • 0

I used Lazy Loader to load image in my listView

and the image is from site

I parse the image’s url to a String array

and set LazyAdapter like this

adapter=new LazyAdapter(this, aStrArray);
           list.setAdapter(adapter);

I’m sure about the aStrArray is not the problem.

(I had Logged it before)

But the ListView just Load the first one Image…

why is that?

Here’s my code

public class BBtest08Activity extends Activity {
/** Called when the activity is first created. */
ListView list;
LazyAdapter adapter;
String aStr;
String aStrArray[];
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    list=(ListView)findViewById(R.id.list);
    try {
        executeHttpGet();
    } catch (Exception e) {
        Log.i("bird","parser failed");
        e.printStackTrace();
    }
    Button b=(Button)findViewById(R.id.button1);
    b.setOnClickListener(listener);
}
@Override
public void onDestroy()
{
    list.setAdapter(null);
    super.onDestroy();
}

public OnClickListener listener=new OnClickListener(){
    @Override
    public void onClick(View arg0) {
        adapter.imageLoader.clearCache();
        adapter.notifyDataSetChanged();
    }
};
public void executeHttpGet() throws Exception {
    try {
    HttpClient client = new DefaultHttpClient();
    HttpGet request = new HttpGet("http://test.mobibon.com.tw/MovieGoTest/GetMovies.js");
    HttpResponse response = client.execute(request); 
     String retSrc = EntityUtils.toString(response.getEntity(),"utf-8");
     retSrc = retSrc.substring(1);//there a space in the very first
       JSONObject obj = new JSONObject(retSrc);
       JSONArray movieArray = obj.getJSONArray("movies");
       for(int i = 0;i < movieArray.length(); i++)
       {
       JSONObject movie_data = movieArray.getJSONObject(i);
       aStr = aStr+movie_data.getString("imageUrl")+",";
       aStrArray = aStr.split(",");
       }
       } finally {
           adapter=new LazyAdapter(this, aStrArray);
           list.setAdapter(adapter);
       }
       }
}

The Lazy Loader from author is like this—

public class MainActivity extends Activity {

ListView list;
LazyAdapter adapter;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    
    list=(ListView)findViewById(R.id.list);
    adapter=new LazyAdapter(this, mStrings);
    list.setAdapter(adapter);
    
    Button b=(Button)findViewById(R.id.button1);
    b.setOnClickListener(listener);
}

@Override
public void onDestroy()
{
    list.setAdapter(null);
    super.onDestroy();
}

public OnClickListener listener=new OnClickListener(){
    @Override
    public void onClick(View arg0) {
        adapter.imageLoader.clearCache();
        adapter.notifyDataSetChanged();
    }
};

private String[] mStrings={
        "http://test.mobibon.com.tw/MovieGoTest/Pics/pl_fmen7122923814_s.jpg",
        "http://test.mobibon.com.tw/MovieGoTest/Pics/pl_fmen7122923814_s.jpg",
        "http://a3.twimg.com/profile_images/121630227/Droid_normal.jpg",
        "http://a1.twimg.com/profile_images/957149154/twitterhalf_normal.jpg",
        "http://a1.twimg.com/profile_images/97470808/icon_normal.png",
        "http://a3.twimg.com/profile_images/511790713/AG.png",
        "http://a3.twimg.com/profile_images/956404323/androinica-avatar_normal.png",
        "http://a1.twimg.com/profile_images/909231146/Android_Biz_Man_normal.png",
        "http://a3.twimg.com/profile_images/72774055/AndroidHomme-LOGO_normal.jpg",
        "http://a1.twimg.com/profile_images/349012784/android_logo_small_normal.jpg",
        "http://a1.twimg.com/profile_images/841338368/ea-twitter-icon.png",
        "http://a3.twimg.com/profile_images/64827025/android-wallpaper6_2560x160_normal.png",
        "http://a3.twimg.com/profile_images/77641093/AndroidPlanet_normal.png",
        "http://a1.twimg.com/profile_images/850960042/elandroidelibre-logo_300x300_normal.jpg",
        "http://a1.twimg.com/profile_images/655119538/andbook.png",
        "http://a3.twimg.com/profile_images/768060227/ap4u_normal.jpg",
        "http://a1.twimg.com/profile_images/74724754/android_logo_normal.png",
        "http://a3.twimg.com/profile_images/681537837/SmallAvatarx150_normal.png",
        "http://a1.twimg.com/profile_images/63737974/2008-11-06_1637_normal.png",
        "http://a3.twimg.com/profile_images/548410609/icon_8_73.png",
        "http://a1.twimg.com/profile_images/612232882/nexusoneavatar_normal.jpg",
        "http://a1.twimg.com/profile_images/213722080/Bugdroid-phone_normal.png",
        "http://a1.twimg.com/profile_images/645523828/OT_icon_090918_android_normal.png",
        "http://a3.twimg.com/profile_images/64827025/android-wallpaper6_2560x160_normal.png",
        "http://a3.twimg.com/profile_images/77641093/AndroidPlanet.png",
        "http://a1.twimg.com/profile_images/850960042/elandroidelibre-logo_300x300_normal.jpg",
        "http://a1.twimg.com/profile_images/655119538/andbook_normal.png",
        "http://a3.twimg.com/profile_images/511790713/AG_normal.png",
        "http://a3.twimg.com/profile_images/956404323/androinica-avatar.png",
        "http://a1.twimg.com/profile_images/909231146/Android_Biz_Man_normal.png",
        "http://a3.twimg.com/profile_images/72774055/AndroidHomme-LOGO_normal.jpg",
        "http://a1.twimg.com/profile_images/349012784/android_logo_small_normal.jpg",
        "http://a1.twimg.com/profile_images/841338368/ea-twitter-icon_normal.png",
        "http://a3.twimg.com/profile_images/64827025/android-wallpaper6_2560x160_normal.png",
        "http://a3.twimg.com/profile_images/77641093/AndroidPlanet.png",
        "http://a3.twimg.com/profile_images/64827025/android-wallpaper6_2560x160_normal.png",
        "http://a3.twimg.com/profile_images/77641093/AndroidPlanet_normal.png",
        "http://a1.twimg.com/profile_images/850960042/elandroidelibre-logo_300x300.jpg",
        "http://a1.twimg.com/profile_images/655119538/andbook_normal.png",
        "http://a3.twimg.com/profile_images/511790713/AG_normal.png",
        "http://a3.twimg.com/profile_images/956404323/androinica-avatar_normal.png",
        "http://a1.twimg.com/profile_images/909231146/Android_Biz_Man_normal.png",
        "http://a3.twimg.com/profile_images/121630227/Droid.jpg",
        "http://a1.twimg.com/profile_images/957149154/twitterhalf_normal.jpg",
        "http://a1.twimg.com/profile_images/97470808/icon_normal.png",
        "http://a3.twimg.com/profile_images/511790713/AG_normal.png",
        "http://a3.twimg.com/profile_images/956404323/androinica-avatar_normal.png",
        "http://a1.twimg.com/profile_images/909231146/Android_Biz_Man.png",
        "http://a3.twimg.com/profile_images/72774055/AndroidHomme-LOGO_normal.jpg",
        "http://a1.twimg.com/profile_images/349012784/android_logo_small_normal.jpg",
        "http://a1.twimg.com/profile_images/841338368/ea-twitter-icon_normal.png",
        "http://a3.twimg.com/profile_images/64827025/android-wallpaper6_2560x160_normal.png",
        "http://a3.twimg.com/profile_images/77641093/AndroidPlanet.png",
        "http://a3.twimg.com/profile_images/670625317/aam-logo-v3-twitter_normal.png",
        "http://a3.twimg.com/profile_images/740897825/AndroidCast-350_normal.png",
        "http://a3.twimg.com/profile_images/121630227/Droid_normal.jpg",
        "http://a1.twimg.com/profile_images/957149154/twitterhalf_normal.jpg",
        "http://a1.twimg.com/profile_images/97470808/icon.png",
        "http://a3.twimg.com/profile_images/511790713/AG_normal.png",
        "http://a3.twimg.com/profile_images/956404323/androinica-avatar_normal.png",
        "http://a1.twimg.com/profile_images/909231146/Android_Biz_Man_normal.png",
        "http://a3.twimg.com/profile_images/72774055/AndroidHomme-LOGO_normal.jpg",
        "http://a1.twimg.com/profile_images/349012784/android_logo_small_normal.jpg",
        "http://a1.twimg.com/profile_images/841338368/ea-twitter-icon.png",
        "http://a3.twimg.com/profile_images/64827025/android-wallpaper6_2560x160_normal.png",
        "http://a3.twimg.com/profile_images/77641093/AndroidPlanet_normal.png",
        "http://a1.twimg.com/profile_images/850960042/elandroidelibre-logo_300x300_normal.jpg",
        "http://a1.twimg.com/profile_images/655119538/andbook_normal.png",
        "http://a3.twimg.com/profile_images/768060227/ap4u_normal.jpg",
        "http://a1.twimg.com/profile_images/74724754/android_logo.png",
        "http://a3.twimg.com/profile_images/681537837/SmallAvatarx150_normal.png",
        "http://a1.twimg.com/profile_images/63737974/2008-11-06_1637_normal.png",
        "http://a3.twimg.com/profile_images/548410609/icon_8_73_normal.png",
        "http://a1.twimg.com/profile_images/612232882/nexusoneavatar_normal.jpg",
        "http://a1.twimg.com/profile_images/213722080/Bugdroid-phone_normal.png",
        "http://a1.twimg.com/profile_images/645523828/OT_icon_090918_android.png",
        "http://a3.twimg.com/profile_images/64827025/android-wallpaper6_2560x160_normal.png",
        "http://a3.twimg.com/profile_images/77641093/AndroidPlanet_normal.png",
        "http://a1.twimg.com/profile_images/850960042/elandroidelibre-logo_300x300_normal.jpg",
        "http://a1.twimg.com/profile_images/655119538/andbook.png",
        "http://a3.twimg.com/profile_images/511790713/AG_normal.png",
        "http://a3.twimg.com/profile_images/956404323/androinica-avatar_normal.png",
        "http://a1.twimg.com/profile_images/909231146/Android_Biz_Man_normal.png",
        "http://a3.twimg.com/profile_images/72774055/AndroidHomme-LOGO_normal.jpg",
        "http://a1.twimg.com/profile_images/349012784/android_logo_small_normal.jpg",
        "http://a1.twimg.com/profile_images/841338368/ea-twitter-icon.png",
        "http://a3.twimg.com/profile_images/64827025/android-wallpaper6_2560x160_normal.png",
        "http://a3.twimg.com/profile_images/77641093/AndroidPlanet_normal.png",
        "http://a3.twimg.com/profile_images/64827025/android-wallpaper6_2560x160_normal.png",
        "http://a3.twimg.com/profile_images/77641093/AndroidPlanet_normal.png",
        "http://a1.twimg.com/profile_images/850960042/elandroidelibre-logo_300x300_normal.jpg",
        "http://a1.twimg.com/profile_images/655119538/andbook_normal.png",
        "http://a3.twimg.com/profile_images/511790713/AG_normal.png",
        "http://a3.twimg.com/profile_images/956404323/androinica-avatar_normal.png",
        "http://a1.twimg.com/profile_images/909231146/Android_Biz_Man_normal.png",
        "http://a3.twimg.com/profile_images/121630227/Droid_normal.jpg",
        "http://a1.twimg.com/profile_images/957149154/twitterhalf.jpg",
        "http://a1.twimg.com/profile_images/97470808/icon_normal.png",
        "http://a3.twimg.com/profile_images/511790713/AG_normal.png",
        "http://a3.twimg.com/profile_images/956404323/androinica-avatar_normal.png",
        "http://a1.twimg.com/profile_images/909231146/Android_Biz_Man_normal.png",
        "http://a3.twimg.com/profile_images/72774055/AndroidHomme-LOGO_normal.jpg",
        "http://a1.twimg.com/profile_images/349012784/android_logo_small.jpg",
        "http://a1.twimg.com/profile_images/841338368/ea-twitter-icon_normal.png",
        "http://a3.twimg.com/profile_images/64827024/android-wallpaper6_2560x160_normal.png",
        "http://a3.twimg.com/profile_images/77641093/AndroidPlanet_normal.png"
};
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:22:12+00:00Added an answer on May 28, 2026 at 2:22 am

    What is more important is the getView function inside the LazyAdapter, you should log inside the getView function to see what url is actually set by the imageView.

    Also, why are you splitting aStr every loop? You should just append new URL to aStr inside the loop and split it into array after the for loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a function to lazy-load the Sizzle selector engine (used by jQuery): var
I have some entity types that I would like to lazy load. However, they
Have you ever used lazy C++? I am trying to create .CPP files out
I have used AsyncTasks with my application, in order to lazy download and update
I have a UITableView in my app in which I load several images from
I have used MEF to load in external XAPs, this works great. But when
In some Django applications I encountered URL patterns with gettext such as: from django.utils.translation
I am using Jquery Lazy Load plugin to load images lazily when they come
My model objects are lazy-loaded from an SQLite database. Don't ask why, but the
With my code I'm using autoload for lazy evaluation so I can load the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.