Android OS 2.3中的方向问题需要帮助

时间:2011-04-09 10:22:18

标签: android

我正在开发Android OS 2.3的Android应用程序,我的应用程序在Nexus OS 2.3中运行,在方向上,我的应用程序已关闭。在logcate中,显示以下错误显示在屏幕上

04-09 15:38:46.543: ERROR/AndroidRuntime(850): FATAL EXCEPTION: main
04-09 15:38:46.543: ERROR/AndroidRuntime(850): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mumbaiway/com.mumbaiway.newdetail.Info}: android.view.InflateException: Binary XML file line #280: Error inflating class <unknown>
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1622)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.os.Looper.loop(Looper.java:123)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.app.ActivityThread.main(ActivityThread.java:3647)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at java.lang.reflect.Method.invokeNative(Native Method)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at java.lang.reflect.Method.invoke(Method.java:507)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at dalvik.system.NativeStart.main(Native Method)
04-09 15:38:46.543: ERROR/AndroidRuntime(850): Caused by: android.view.InflateException: Binary XML file line #280: Error inflating class <unknown>
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.view.LayoutInflater.createView(LayoutInflater.java:518)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.app.Activity.setContentView(Activity.java:1657)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at com.mumbaiway.newdetail.Info.onCreate(Info.java:127)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     ... 11 more
04-09 15:38:46.543: ERROR/AndroidRuntime(850): Caused by: java.lang.reflect.InvocationTargetException
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at java.lang.reflect.Constructor.constructNative(Native Method)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.view.LayoutInflater.createView(LayoutInflater.java:505)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     ... 25 more
04-09 15:38:46.543: ERROR/AndroidRuntime(850): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:450)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:326)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.content.res.Resources.loadDrawable(Resources.java:1709)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.view.View.<init>(View.java:1951)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.widget.ImageView.<init>(ImageView.java:112)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.widget.ImageButton.<init>(ImageButton.java:85)
04-09 15:38:46.543: ERROR/AndroidRuntime(850):     at android.widget.ImageButton.<init>(ImageButton.java:81)

如何在Android OS 2.3中解决此问题

谢谢朋友们, JRIck

2 个答案:

答案 0 :(得分:0)

您没有破坏导致内存不足情况的位图。完成后立即调用bitmap.recycle()

答案 1 :(得分:0)

如果你看错了,这就是你应该担心的问题:

Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget

你耗尽了太多记忆。可能会有各种各样的事情发生,一个开始可能是@Vinoth说看你的位图,以及你是如何摧毁(或不是!)他们。也许你有一个内存泄漏,当你开始一个新的活动,泄漏旧的,并有两倍的东西?这只是猜测,但麻烦在于内存使用:)