有一段字符串
“hello world!!<img src='http://www.xxx.com/1.jpg;> "请问怎么做?????
“hello world!!<img src='http://www.xxx.com/1.jpg;> "请问怎么做?????
解决方案 »
- 求助官网下载的Android SDK安装后用SDK Manager安装没反应。。。求助。。求助
- 有关Android 的MapView 的使用,求解
- android不明原因报错
- android jni 问题
- android急救
- 有关EditText中设置inputType后minLines属性无效的问题
- 关于XP下编译FFMPEG的问题,config.sh执行不了
- 高分求助:Android多语言【时间】的问题
- android 如何执行大批量post请求?
- 使用TextureView预览摄像头画面,画面滚动的问题
- android怎么解析pdf文件呀 知道的大神们帮帮忙
- 3G上网与互联网通讯不能P2P,请高手指点。
LoadImageTask task = new LoadImageTask(convertView);
task.execute("http://www.xxx.com/1.jpg"); //加载图片的异步任务
class LoadImageTask extends AsyncTask<String,Void,Bitmap>{
private View resultView;
// doInBackground完成后才会被调用
@Override
protected void onPostExecute(Bitmap bitmap) {
//调用setTag保存图片以便于自动更新图片
imageView.setTag(bitmap);
} //从网上下载图片
@Override
protected Bitmap doInBackground(String... params) {
//new URL对象 把网址传入
URL url = new URL(params[0]);
//取得链接
URLConnection conn = url.openConnection();
conn.connect();
//取得返回的InputStream
InputStream is = conn.getInputStream();
//将InputStream变为Bitmap
return BitmapFactory.decodeStream(is);
}
}