-1
我的應用程序在大多數設備,但在一些設備的運行不運行,並在Mainactivity.java的錯誤是如何啓動另一個活動時java.lang.OutOfMemoryError
java.lang.OutOfMemoryError
我想在SplashScreen.java如果不要運行Mainactivity.java,運行其他活動,例如Main2.activity
我用這個代碼,但不工作:
try {
Intent mainactivity = new Intent(SplashScreen.this, MainActivity.class);
startActivity(mainactivity);
}
catch (OutOfMemoryError e) {
Intent main2 = new Intent(SplashScreen.this, Main2.class);
startActivity(main2);
}
請幫助
my logcat:
10-22 08:32:28.311: E/AndroidRuntime(1394): FATAL EXCEPTION: main
10-22 08:32:28.311: E/AndroidRuntime(1394): Process: ir.maddahha.imamalip, PID: 1394
10-22 08:32:28.311: E/AndroidRuntime(1394): java.lang.OutOfMemoryError
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:594)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:429)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:840)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.content.res.Resources.loadDrawable(Resources.java:2110)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.content.res.Resources.getDrawable(Resources.java:700)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.graphics.drawable.AnimationDrawable.inflate(AnimationDrawable.java:282)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:937)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.content.res.Resources.loadDrawable(Resources.java:2092)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.content.res.Resources.getDrawable(Resources.java:700)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.view.View.setBackgroundResource(View.java:15303)
10-22 08:32:28.311: E/AndroidRuntime(1394): at ir.maddahha.imamalip.Main.onCreate(Main.java:43)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.app.Activity.performCreate(Activity.java:5231)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.app.ActivityThread.access$800(ActivityThread.java:135)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.os.Handler.dispatchMessage(Handler.java:102)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.os.Looper.loop(Looper.java:136)
10-22 08:32:28.311: E/AndroidRuntime(1394): at android.app.ActivityThread.main(ActivityThread.java:5001)
10-22 08:32:28.311: E/AndroidRuntime(1394): at java.lang.reflect.Method.invokeNative(Native Method)
10-22 08:32:28.311: E/AndroidRuntime(1394): at java.lang.reflect.Method.invoke(Method.java:515)
10-22 08:32:28.311: E/AndroidRuntime(1394): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
10-22 08:32:28.311: E/AndroidRuntime(1394): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
10-22 08:32:28.311: E/AndroidRuntime(1394): at dalvik.system.NativeStart.main(Native Method)
請把logcat – Palak 2014-10-22 09:01:48