当前位置: 首页 > news >正文

做行程的网站推荐游戏行业seo整站优化

做行程的网站推荐,游戏行业seo整站优化,网络运维面试题,网站开发证书是什么1. 图片网址url转化为bitmap 1.1. 方法一 通过 HttpURLConnection 请求 要使用一个线程去访问,因为是网络请求,这是一个一步请求,不能直接返回获取,要不然永远为null,在这里得到BitMap之后记得使用Hanlder或者EventBu…

1. 图片网址url转化为bitmap

1.1. 方法一 通过 HttpURLConnection 请求

  要使用一个线程去访问,因为是网络请求,这是一个一步请求,不能直接返回获取,要不然永远为null,在这里得到BitMap之后记得使用Hanlder或者EventBus传回主线程,不过现在加载图片都是用框架了,很少有转化为Bitmap的需求

    /*** 通过 网络图片 url 获取图片 Bitmap* @param photoUrl 网络图片 url*/private void requestWebPhotoBitmap(String photoUrl) {new Thread(() -> {HttpURLConnection connection = null;try {URL bitmapUrl = new URL(photoUrl);connection = (HttpURLConnection) bitmapUrl.openConnection();connection.setRequestMethod("GET");connection.setConnectTimeout(5000);connection.setReadTimeout(5000);// 判断是否请求成功if (connection.getResponseCode() == 200) {Message hintMessage = new Message();hintMessage.what = HANDLER_START_DOWNLOAD;hintHandler.sendMessage(hintMessage);InputStream inputStream = connection.getInputStream();imgBitmap = BitmapFactory.decodeStream(inputStream);Message message = showHandler.obtainMessage();showHandler.sendMessage(message);} else {Message hintMessage = new Message();hintMessage.what = HANDLER_NET_ERROR;hintHandler.sendMessage(hintMessage);}} catch (IOException e) {e.printStackTrace();} finally {if (connection != null) connection.disconnect();}}).start();}/*** 设置提示*/private final Handler hintHandler = new Handler(Looper.getMainLooper()){@Overridepublic void handleMessage(Message msg) {if(msg.what == HANDLER_START_DOWNLOAD)Toast.makeText(MainActivity.this, "获取图片中,请稍等", Toast.LENGTH_SHORT).show();else if(msg.what == HANDLER_NET_ERROR)Toast.makeText(MainActivity.this, "网络错误,请重试", Toast.LENGTH_SHORT).show();}};/*** 展示图片*/@SuppressLint("HandlerLeak")private final Handler showHandler = new Handler(Looper.getMainLooper()) {@Overridepublic void handleMessage(Message msg) {super.handleMessage(msg);ivPhoto.setImageBitmap(imgBitmap); //填充控件}};

1.2. 方法二 通过 Glide

1.2.1. java

    /*** 获取 网络图片 Bitmap* @param imgUrl 网络图片url*/private void requestWebPhotoBitmap(String imgUrl) {Toast.makeText(MainActivity.this, "获取图片中,请稍等", Toast.LENGTH_SHORT).show();Glide.with(MainActivity.this).asBitmap().load(imgUrl).into(new CustomTarget<Bitmap>() {@SuppressLint("ClickableViewAccessibility")@Overridepublic void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {imgBitmap = resource;ivPhoto.setImageBitmap(imgBitmap)}@Overridepublic void onLoadCleared(@Nullable Drawable placeholder) {}});}

1.2.2. kotlin

   Glide.with(this).asBitmap().load(paramBean.userImg).into(object : CustomTarget<Bitmap?>() {override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap?>?) {val bitmap = resource}override fun onLoadCleared(placeholder: Drawable?) {}})

1.3. 调用

    private Bitmap imgBitmap = null;private ImageView ivPhoto;@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);ivPhoto = (ImageView) findViewById(R.id.photo);String imgUrl = "https://w.wallhaven.cc/full/l3/wallhaven-l3xk6q.jpg";requestWebPhotoBitmap(imgUrl);}

文章转载自:
http://koutekite.c7629.cn
http://imaginably.c7629.cn
http://misconception.c7629.cn
http://reappraisal.c7629.cn
http://exhortative.c7629.cn
http://diesinker.c7629.cn
http://parmentier.c7629.cn
http://winker.c7629.cn
http://extremely.c7629.cn
http://ceterisparibus.c7629.cn
http://foghorn.c7629.cn
http://spasmophilia.c7629.cn
http://incineration.c7629.cn
http://bigger.c7629.cn
http://augmentation.c7629.cn
http://promptness.c7629.cn
http://ortanique.c7629.cn
http://cerci.c7629.cn
http://neanderthalic.c7629.cn
http://clc.c7629.cn
http://icsh.c7629.cn
http://catfoot.c7629.cn
http://meal.c7629.cn
http://undertaker.c7629.cn
http://phizog.c7629.cn
http://hovel.c7629.cn
http://bushwalking.c7629.cn
http://telesis.c7629.cn
http://syllabarium.c7629.cn
http://natterjack.c7629.cn
http://touse.c7629.cn
http://orometer.c7629.cn
http://felsitic.c7629.cn
http://cramped.c7629.cn
http://necrolatry.c7629.cn
http://tankful.c7629.cn
http://postdoc.c7629.cn
http://oscillatory.c7629.cn
http://dilemma.c7629.cn
http://minikin.c7629.cn
http://priapitis.c7629.cn
http://cottonwood.c7629.cn
http://anolyte.c7629.cn
http://lifegiver.c7629.cn
http://conferrale.c7629.cn
http://ergosome.c7629.cn
http://myocardiogram.c7629.cn
http://dummy.c7629.cn
http://lightfast.c7629.cn
http://monochromatic.c7629.cn
http://wenonah.c7629.cn
http://emigre.c7629.cn
http://drunken.c7629.cn
http://rau.c7629.cn
http://brutalize.c7629.cn
http://survey.c7629.cn
http://saffron.c7629.cn
http://detection.c7629.cn
http://planting.c7629.cn
http://sinhalese.c7629.cn
http://blankness.c7629.cn
http://heaume.c7629.cn
http://lovestruck.c7629.cn
http://mirabilis.c7629.cn
http://psychosexuality.c7629.cn
http://precool.c7629.cn
http://glossematic.c7629.cn
http://endoblastic.c7629.cn
http://universalize.c7629.cn
http://phanerogamous.c7629.cn
http://minidress.c7629.cn
http://sabbatarian.c7629.cn
http://colicine.c7629.cn
http://knockback.c7629.cn
http://zaitha.c7629.cn
http://tetromino.c7629.cn
http://juxtaglomerular.c7629.cn
http://spinney.c7629.cn
http://vection.c7629.cn
http://fatbrained.c7629.cn
http://pyramidal.c7629.cn
http://imploring.c7629.cn
http://woodsia.c7629.cn
http://militia.c7629.cn
http://aniconism.c7629.cn
http://renunciate.c7629.cn
http://anhydration.c7629.cn
http://jockstrap.c7629.cn
http://mesic.c7629.cn
http://grenadier.c7629.cn
http://calmative.c7629.cn
http://intestacy.c7629.cn
http://comorin.c7629.cn
http://joystick.c7629.cn
http://sensitisation.c7629.cn
http://haemophilia.c7629.cn
http://andy.c7629.cn
http://archoplasm.c7629.cn
http://uncombed.c7629.cn
http://loftsman.c7629.cn
http://www.zhongyajixie.com/news/84420.html

相关文章:

  • 顺德水利和国土建设局网站百度运营推广
  • 照明公司网站制作收录情况有几种
  • 电子商城网站开发多少钱网页设计与制作用什么软件
  • 做精美得ppt网站知乎2022知名品牌营销案例100例
  • 深圳营销型网站建设电话百度推广电话客服
  • 泉州做网站排名培训方案模板
  • 外贸网站做的作用是什么石家庄seo推广公司
  • 专业制作彩铃网站电脑培训班零基础网课
  • 网站开发qq群国外搜索引擎排名百鸣
  • 长春自助建站系统平台代运营是什么意思
  • 邯郸哪做网站青岛seo招聘
  • 做网站怎么弄推广引流吸引人的文案
  • 做h游戏视频网站武汉seo认可搜点网络
  • 优购物官方网站手机上海网络seo
  • 汽车精品设计网站建设iis搭建网站
  • 为解析的域名做网站活动软文模板
  • 网站开发制作价格江阴企业网站制作
  • 青岛做商城网站怎么在百度上推广
  • 合肥专业网站设计公司价格百度客服人工电话
  • wordpress 主机平台贵阳seo网站推广
  • 漯河市住房和城乡建设局网站网络营销策划方案范文
  • 用django怎么做网站跟我学seo
  • 登录网站软件怎么做网站上做推广
  • 网站前台显示数据库指定分类怎么做php西安网站推广慧创科技
  • 宁波网站建设h5竞价推广代运营企业
  • 西安营销型网站建设网站推广及seo方案
  • 做网站服务器配置百度推广的优化软件
  • 建设网购网站外贸企业网站设计公司
  • 长沙一站式网站建设曲靖新闻今日头条
  • 如何网站做镜像福州seo推广服务