3

我是 android 应用程序的新开发人员。我正在显示来自 .net db 服务的图像。我正在使用 SoapObject 类与 .net Web 服务进行通信。当我将获取图像的请求发送到 db 时,它返回编码字符串。我将这些字符串存储在一个字符串数组中。在延迟加载概念中,他们将 url 存储到一个字符串数组中,他们将该数组传递给 LazyAdapter 类。而不是 url 字符串数组,我传递响应字符串数组如下

要求:

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

回复:

  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 我在这个类中写了getView方法如下

  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;

}

从上面的代码中,我在响应完成后查看图像。在查看图像之前,我得到的是空白屏幕,但不是默认图像。

如何在响应完成之前显示默认图像?

plzzz任何人帮助我

4

1 回答 1

1
  1. 你需要使用 image.setTag(data[position])
  2. 在 item1.xml 的 xml 中你需要给出

于 2011-09-26T17:39:38.147 回答