Android,在imageview上一张一张显示图片列表

标签 android eclipse image list crash

我正在使用 eclipse for android,并制作了一个有 2 个 ImageView 和 textview 中的问题的应用程序,因此用户必须单击属于问题的图像...
但是每次用户单击 imageview 应用程序时,都会显示另外两个图像和另一个问题..

我做了什么:

  • 带有图像名称的列表,
  • 洗牌,
  • 单击 imageview 3 秒后,从 assets 目录中获取 2 个其他图像...

  • 但在某些手机上,我遇到了这个崩溃:

    在 android.graphics.BitmapFactory.nativeDecodeAsset

    java.lang.OutOfMemoryError at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:490) at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:358) at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:773) at android.graphics.drawable.Drawable.createFromStream(Drawable.java:733) at com.al.Play.MerFoton(Play.java:174) at com.al.Play.mer(Play.java:154) at com.al.Play.access$3(Play.java:132) at com.al.Play$MyCounter.onFinish(Play.java:329) at android.os.CountDownTimer$1.handleMessage(CountDownTimer.java:118) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4424) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) at dalvik.system.NativeStart.main(Native Method)



    是我在应用程序中更改了很多图像还是其他问题?

    最佳答案

    我在下一个图书馆:

    http://www.androidhive.info/2012/07/android-loading-image-from-url-http/

    在库中使用内存缓存来保存图像和图片的性能可视化。

    关于Android,在imageview上一张一张显示图片列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29617080/

    相关文章:

    android - 如何更改 ListView 中的图像?

    c++ - SDL基本程序不工作但代码没问题

    java - Android:让服务定期检查某些内容

    java - 当传递给 Intent 构造函数时,从事件处理程序传递 this 与 ClassName.this 有什么区别?

    java - Android最佳实践——下载图片

    Android adb 命令获取设备上的联系人总数

    java - 在 IDE 中同时调试 Java 和 Javascript

    java - 从 android 服务器加载 gridView 中的图像

    eclipse - Tomcat 7.0 : Integrate with Eclipse

    ios - API图像文件上传iPhone到Ruby on Rails