prasad.gai
prasad.gai

Reputation: 2987

how to display images by using db response like lazylist concept?

i am new developer in android application.i am working on display the images from .net db services.i am communicating with .net web services by using SoapObject class.when i send the request for get the images to db then it is returning encoded strings.i am storing those string in an string array.In Lazy load concept they have stored urls into a string array they are passing that array into LazyAdapter class.instead of url string array i am passing response string array as follows

Request:

 String photoXml="<spGetUserPhoto><UserID>148</UserID></spGetUserPhoto>";

Response:

  String response=new ParseXMLString().getUserPhotos(newGeneric().photInfo(photoXml));
  String[] photos=new String[response.size()];
  for(int i=0;i<response.size();i++)
  {
      photos[i]=photoResponse;

   }  

        list=(ListView)findViewById(R.id.list);
        adapter=new LazyAdapter(this, photos);
        list.setAdapter(adapter);

LazyAdapter.java i have written getView method in this class as follows

  public View getView(int position, View convertView, ViewGroup parent) {
    View vi=convertView;


    if(convertView==null)
        vi = inflater.inflate(R.layout.item1, null);

     TextView text=(TextView)vi.findViewById(R.id.txtViewTitle);;
     ImageView image=(ImageView)vi.findViewById(R.id.imgViewLogo);

     text.setText(messages[position]);
     try {
        imageLoader.DisplayImage(data[position], activity, image);

    } catch (Exception e) {

        e.printStackTrace();
    }

    return vi;

}

From the above code i am viewing images when the response has completed.before view the image i am getting blank screen but not default image.

How to display default image untill completion of response?

plzzz any body help me

Upvotes: 3

Views: 352

Answers (1)

hunterp
hunterp

Reputation: 15976

  1. you need to use image.setTag(data[position])
  2. In the xml of item1.xml you need to give

Upvotes: 1

Related Questions