Android的图像视图使得应用程序慢 [英] Android image view makes app slow

查看:233
本文介绍了Android的图像视图使得应用程序慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用我有一个列表视图,其中包含一个图像视图。图像从bas64 EN codeD字符串加载。第一字符串是德$ C $光盘,然后将它转换为位图,然后该位图被加载到图像视图。
所有的解码是在异步任务完成,并发是根据下面的文档处理。

In my app I have a list view, which contains an image view. The image is loaded from bas64 encoded string. First the string is decoded and then converted it to bitmap and then the bitmap is loaded to the image view. All the decoding is done in an async task and concurrency is handled according to the below documentation.

处理位图关闭UI线程

问题是应用程序正在滚动慢,和所有其他异步任务后,未执行。

The problem is the app is scrolling slow, and all other async tasks are not executing after that.

任何可能的解决方案?

推荐答案

如果您是从服务器获取图像的URL,如果你想在本地数据库可以存储。不要存放的base64数据库中只存储图像URL's.But用于图像加载,你可以简单地使用可用如滑翔库毕加索获取图像加载。您的列表视图滞后因为你是做这样的base64解码和加载该位图重操作。只要给它一个尝试,它会工作。可以使用单线code加载图像像

If you are getting image URL from server you can store if you want to in local DB. Don't store base64 in database just store the image URL's.But for image loading you can simply use libraries that are available like Glide or Picasso for image loading. Your list view is lagging as you are doing heavy operation like decoding base64 and loading that bitmap. Just give it a try, it will work. You can load image using single line code like

ImageView imageView = (ImageView) findViewById(R.id.my_image_view);

Glide.with(this).load("http://goo.gl/gEgYUd").into(imageView);

这篇关于Android的图像视图使得应用程序慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆