private ImageView imageView;
private List<String> list = new ArrayList<>();
private int index = 0;
private Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
if (msg.what == 0){
//街道消息之后,,,切换图片显示
index ++;
ImageLoader.getInstance().displayImage(list.get(index %list.size()),imageView,ImageLoaderUtil.getDefaultOption());
//再次发送
handler.sendEmptyMessageDelayed(0,3000);
}
}
};
//异步的第二个方法:
//解析
Gson gson = new Gson();
DataDataBean dataDataBean = gson.fromJson(s, DataDataBean.class);
List<DataDataBean.ResultBean.DataBean.StepsBean> steps = dataDataBean.getResult().getData().get(0).getSteps();
for (DataDataBean.ResultBean.DataBean.StepsBean st: steps) {
list.add(st.getImg());
}
//现在图片集合有数据,,,,展示图片,,,展示第一张图片
ImageLoader.getInstance().displayImage(list.get(0),imageView,ImageLoaderUtil.getDefaultOption());
//发送延时消息
handler.sendEmptyMessageDelayed(0,3000);
}