运行我的应用程序时,我一直收到此错误.该应用程序可以正常编译,一旦我开始与它进行交互(ImageSlIDer),有时它会崩溃并显示该消息.
logcat的
02-18 12:25:05.426: E/AndroIDRuntime(4545): FATAL EXCEPTION: main02-18 12:25:05.426: E/AndroIDRuntime(4545): java.lang.OutOfMemoryError02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.graphics.BitmapFactory.nativeDecodeStream(Native Method)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.graphics.BitmapFactory.decodeStream(BitmapFactory.java:493)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.graphics.BitmapFactory.decodefile(BitmapFactory.java:299)02-18 12:25:05.426: E/AndroIDRuntime(4545): at com.oneplc.vIEssmannapp.imageslIDer.adapter.FullScreenImageAdapter.instantiateItem(FullScreenImageAdapter.java:59)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.support.v4.vIEw.VIEwPager.addNewItem(VIEwPager.java:832)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.support.v4.vIEw.VIEwPager.populate(VIEwPager.java:1016)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.support.v4.vIEw.VIEwPager.populate(VIEwPager.java:914)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.support.v4.vIEw.VIEwPager.run(VIEwPager.java:244)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.support.v4.vIEw.VIEwPager.completeScroll(VIEwPager.java:1761)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.support.v4.vIEw.VIEwPager.onIntercepttouchEvent(VIEwPager.java:1894)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.vIEw.VIEwGroup.dispatchtouchEvent(VIEwGroup.java:1629)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.vIEw.VIEwGroup.dispatchtransformedtouchEvent(VIEwGroup.java:1957)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.vIEw.VIEwGroup.dispatchtouchEvent(VIEwGroup.java:1684)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.vIEw.VIEwGroup.dispatchtransformedtouchEvent(VIEwGroup.java:1957)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.vIEw.VIEwGroup.dispatchtouchEvent(VIEwGroup.java:1684)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.vIEw.VIEwGroup.dispatchtransformedtouchEvent(VIEwGroup.java:1957)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.vIEw.VIEwGroup.dispatchtouchEvent(VIEwGroup.java:1684)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.vIEw.VIEwGroup.dispatchtransformedtouchEvent(VIEwGroup.java:1957)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.vIEw.VIEwGroup.dispatchtouchEvent(VIEwGroup.java:1684)02-18 12:25:05.426: E/AndroIDRuntime(4545): at com.androID.internal.policy.impl.PhoneWindow$DecorVIEw.superdispatchtouchEvent(PhoneWindow.java:1917)02-18 12:25:05.426: E/AndroIDRuntime(4545): at com.androID.internal.policy.impl.PhoneWindow.superdispatchtouchEvent(PhoneWindow.java:1371)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.app.Activity.dispatchtouchEvent(Activity.java:2364)02-18 12:25:05.426: E/AndroIDRuntime(4545): at com.androID.internal.policy.impl.PhoneWindow$DecorVIEw.dispatchtouchEvent(PhoneWindow.java:1865)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.vIEw.VIEw.dispatchPointerEvent(VIEw.java:5721)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.vIEw.VIEwRootImpl.deliverPointerEvent(VIEwRootImpl.java:2890)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.vIEw.VIEwRootImpl.handleMessage(VIEwRootImpl.java:2466)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.vIEw.VIEwRootImpl.processinputEvents(VIEwRootImpl.java:845)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.vIEw.VIEwRootImpl.handleMessage(VIEwRootImpl.java:2475)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.os.Handler.dispatchMessage(Handler.java:99)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.os.Looper.loop(Looper.java:137)02-18 12:25:05.426: E/AndroIDRuntime(4545): at androID.app.ActivityThread.main(ActivityThread.java:4424)02-18 12:25:05.426: E/AndroIDRuntime(4545): at java.lang.reflect.Method.invokeNative(Native Method)02-18 12:25:05.426: E/AndroIDRuntime(4545): at java.lang.reflect.Method.invoke(Method.java:511)02-18 12:25:05.426: E/AndroIDRuntime(4545): at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)02-18 12:25:05.426: E/AndroIDRuntime(4545): at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:551)02-18 12:25:05.426: E/AndroIDRuntime(4545): at dalvik.system.NativeStart.main(Native Method)
第59行的RESPONSIBLE / FullScreenImageAdapter.java类
public class FullScreenImageAdapter extends PagerAdapter { private Activity _activity; private ArrayList<String> _imagePaths; private LayoutInflater inflater; // constructor public FullScreenImageAdapter(Activity activity, ArrayList<String> imagePaths) { this._activity = activity; this._imagePaths = imagePaths; } @OverrIDe public int getCount() { return this._imagePaths.size(); } @OverrIDe public boolean isVIEwFromObject(VIEw vIEw, Object object) { return vIEw == ((relativeLayout) object); } @OverrIDe public Object instantiateItem(VIEwGroup container, int position) { touchImageVIEw imgdisplay; button btnClose; inflater = (LayoutInflater) _activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); VIEw vIEwLayout = inflater.inflate(R.layout.layout_fullscreen_image, container, false); imgdisplay = (touchImageVIEw) vIEwLayout.findVIEwByID(R.ID.imgdisplay); btnClose = (button) vIEwLayout.findVIEwByID(R.ID.btnClose); BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.ARGB_8888; Bitmap bitmap = BitmapFactory.decodefile(_imagePaths.get(position), options); imgdisplay.setimageBitmap(bitmap); // close button click event btnClose.setonClickListener(new VIEw.OnClickListener() { @OverrIDe public voID onClick(VIEw v) { _activity.finish(); } }); ((VIEwPager) container).addVIEw(vIEwLayout); return vIEwLayout; } @OverrIDe public voID destroyItem(VIEwGroup container, int position, Object object) { ((VIEwPager) container).removeVIEw((relativeLayout) object); }}
评论
我看到了其他一些线程,但是它们对我的情况没有帮助,或者至少无法实现.
知道如何解决这个问题吗?
解决方法:
如果Google文档没有帮助(他们有一些巧妙的技巧),作为最后的选择,您可以尝试添加
androID:largeHeap =“ true”到< application> AndroIDManifest.xml中的代码.但实际上,不得已.
以上是内存溢出为你收集整理的致命异常:android.graphics.BitmapFactory.nativeDecodeStream上的main java.lang.OutOfMemoryError(本地方法)全部内容,希望文章能够帮你解决致命异常:android.graphics.BitmapFactory.nativeDecodeStream上的main java.lang.OutOfMemoryError(本地方法)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)