InputStream in=con.getInputStream();
Bitmap bit=BitmapFactory.decodeStream(in);
Message msg=Message.obtain();
msg.obj=bit;
handler.sendMessage(msg);
1、bitmap这个类的作用是什么?
2、静态方法 obtain 为什么效率高?
InputStream in=con.getInputStream();
Bitmap bit=BitmapFactory.decodeStream(in);
Message msg=Message.obtain();
msg.obj=bit;
handler.sendMessage(msg);
1、bitmap这个类的作用是什么?
2、静态方法 obtain 为什么效率高?
Bitmap,你就把它当做是图片的一种存在格式就行了。Android中使用图片,一般不是Bitmap就是Drawable。
Message.obtain,是将闲置的消息对象直接拿来用,省去了创建等流程,所以效率高,省内存。