package com.chaoran.thread;

import java.io.IOException;
import java.util.HashMap;

import com.chaoran.entiry.SelfImage;
import com.util.BitMapUtil;

import android.graphics.Bitmap;
import android.os.Handler;
import android.os.Message;
import android.widget.ImageView;

public class ImageUrl implements Runnable {
	private SelfImage img;
	private String url;
	private Handler handler;

	public ImageUrl(SelfImage img, String url, Handler handler) {
		this.img = img;
		this.url = url;
		this.handler = handler;
	}

	@Override
	public void run() {
		 Bitmap bitMap;
		 Message msg = new Message();
		try {
			bitMap = BitMapUtil.generateBitMap(url);
			HashMap map=new HashMap();
			map.put("image", img);
			map.put("bitMap", bitMap);
			msg.obj =map;
			handler.sendMessage(msg);
		} catch (IOException e) {
			msg.what=-1;
			handler.sendMessage(msg);
		}
	}

}
