AndroidAnnotations Activity.intent(context)产生Memory Exception

时间:2015-11-20 20:13:43

标签: java android android-intent android-annotations

使用Android Annotations启动意图时

Activity.intent(context).flags(...).start();

运行时代码生成:

-heap: Out of memory on a 19484880-byte allocation.
: "main" prio=5 tid=1 RUNNABLE
:   | group="main" sCount=0 dsCount=0 obj=0xa62624b0 self=0xb7f67510
:   | sysTid=12289 nice=0 sched=0/0 cgrp=[fopen-error:2] handle=-1217141696
:   | schedstat=( 1200492251 772859215 5556 ) utm=83 stm=36 core=0
:     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
:     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
:     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
:     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
:     at android.content.res.Resources.loadDrawable(Resources.java:1930)
:     at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
:     at android.widget.ImageView.<init>(ImageView.java:120)
:     at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:58)
:     at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:54)
:     at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:95)
:     at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:938)
:     at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:992)
:     at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675)
:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
:     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)
:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
:     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)
:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
:     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
:     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
:     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
:     at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)
:     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
:     at package.activity.HomeActivity_.setContentView(HomeActivity_.java:57)
:     at package.activity.HomeActivity_.onCreate(HomeActivity_.java:48)
:     at android.app.Activity.performCreate(Activity.java:5008)
:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
:     at android.app.ActivityThread.access$600(ActivityThread.java:130)
:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
:     at android.os.Handler.dispatchMessage(Handler.java:99)
:     at android.os.Looper.loop(Looper.java:137)
:     at android.app.ActivityThread.main(ActivityThread.java:4745)
:     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:786)
:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
:     at dalvik.system.NativeStart.main(Native Method)

我第二次启动意图,我的意思是,我第一次启动意图并且一切正常,我按下硬件按钮并重新启动意图并产生异常。

我做得不好?

我试过了旗帜:

.flags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
.flags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
.flags(Intent.FLAG_ACTIVITY_NEW_TASK)
单独和togheter。

0 个答案:

没有答案