【发布时间】:2017-02-20 09:50:20
【问题描述】:
我必须使用 android 创建一个应用程序,该应用程序可以将用户图像查看到 circularimageview 以用于 circularimageview 我正在使用 com.pkmmte.view.CircularImageView 库并使用位图显示来自 URL 的图像,但我无法在 imageview 中显示图像它显示了一些错误
D/dalvikvm: GC_FOR_ALLOC freed 277K, 5% free 7693K/8044K, paused 2ms, total 2ms
D/dalvikvm: GC_FOR_ALLOC freed 747K, 9% free 8469K/9288K, paused 8ms, total 8ms
E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /http:/hennasilks.com/jijo/informe/profile_images/galimg2017-02- 16T11:16:02.403+0530178.jpeg: open failed: ENOENT (No such file or directory)
I/System.out: jijonull
E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /http:/hennasilks.com/jijo/informe/profile_images/galimg2017-02-16T11:16:02.403+0530178.jpeg: open failed: ENOENT (No such file or directory)
I/System.out: jijonull
E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /http:/hennasilks.com/jijo/informe/profile_images/galimg2017-02-16T11:16:02.403+0530178.jpeg: open failed: ENOENT (No such file or directory)
I/System.out: jijonull
D/dalvikvm: GC_FOR_ALLOC freed 325K, 7% free 9612K/10284K, paused 5ms, total 6ms
I/dalvikvm-heap: Grow heap (frag case) to 11.409MB for 2048012-byte allocation
D/dalvikvm: GC_FOR_ALLOC freed 5K, 6% free 11606K/12288K, paused 7ms, total 7ms
D/dalvikvm: GC_FOR_ALLOC freed 34K, 6% free 11604K/12288K, paused 5ms, total 5ms
I/dalvikvm-heap: Grow heap (frag case) to 29.683MB for 19170444-byte allocation
D/dalvikvm: GC_FOR_ALLOC freed 4K, 3% free 30320K/31012K, paused 4ms, total 4ms
V/FA: Inactivity, disconnecting from the service
V/FA: onUnbind called for intent. action: com.google.android.gms.measurement.START
V/FA: Local AppMeasurementService is shutting down
这是我使用显示图像的代码
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 4;
String profurl="http://hennasilks.com/jijo/informe/profile_images/galimg2017-02-16T11:16:02.403+0530178.jpeg";
Bitmap bitmap = BitmapFactory.decodeFile(profurl,options);
System.out.println("jijo"+bitmap);
int height = bitmap.getHeight(), width = bitmap.getWidth();
if (height > 1280 && width > 960)
{
Bitmap imgbitmap = BitmapFactory.decodeFile(profurl);
holder.prof.setImageURI(Uri.parse(String.valueOf(imgbitmap)));
holder.prof.setVisibility(View.VISIBLE);
}
else {
holder.prof.setImageURI(Uri.parse(String.valueOf(bitmap)));
holder.prof.setVisibility(View.VISIBLE);
}
请帮我找到解决方案提前谢谢
【问题讨论】:
-
使用毕加索或滑行
-
@DeepakKumar 举例
-
如果你想通过 URL 加载图像,那么你应该使用 picasso 或 glide,因为它使用起来非常简单且重量轻
-
请举个例子
标签: android url bitmap android-imageview bitmapfactory