如何使用像惰性列表概念这样的数据库响应来显示图像?
我是 android 应用程序的新开发人员。我正在努力显示来自 .net db 服务的图像。我正在使用 SoapObject 类与 .net Web 服务进行通信。当我发送获取图像的请求到 db 时,它会返回编码的strings.i 将这些字符串存储在字符串数组中。在延迟加载概念中,他们已将 url 存储到字符串数组中,他们将该数组传递到 LazyAdapter 类中。我传递的不是 url 字符串数组,而是传递响应字符串数组,如下
Request :
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;
}
从上面的代码中,我在响应完成时查看图像。在查看图像之前,我得到的是空白屏幕,但不是默认图像。
如何显示默认图像直到响应完成?
请任何人帮助我
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)