04-16 11:33:40.160: E/AndroidRuntime(18377): FATAL EXCEPTION: main
04-16 11:33:40.160: E/AndroidRuntime(18377): java.lang.OutOfMemoryError
04-16 11:33:40.160: E/AndroidRuntime(18377): at android.graphics.Bitmap.nativeCreate(Native Method)
04-16 11:33:40.160: E/AndroidRuntime(18377): at android.graphics.Bitmap.createBitmap(Bitmap.java:604)
04-16 11:33:40.160: E/AndroidRuntime(18377): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
04-16 11:33:40.160: E/AndroidRuntime(18377): at com.android.restaurant.DescriptionPage.getResizedBitmap(DescriptionPage.java:327)
04-16 11:33:40.160: E/AndroidRuntime(18377): at com.android.restaurant.DescriptionPage.setDetailsIntoLayout(DescriptionPage.java:172)
04-16 11:33:40.160: E/AndroidRuntime(18377): at com.android.restaurant.DescriptionPage.onCreate(DescriptionPage.java:101)
04-16 11:33:40.160: E/AndroidRuntime(18377): at android.app.Activity.performCreate(Activity.java:4397)
04-16 11:33:40.160: E/AndroidRuntime(18377): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
04-16 11:33:40.160: E/AndroidRuntime(18377): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1782)
04-16 11:33:40.160: E/AndroidRuntime(18377): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1834)
04-16 11:33:40.160: E/AndroidRuntime(18377): at android.app.ActivityThread.access$500(ActivityThread.java:125)
04-16 11:33:40.160: E/AndroidRuntime(18377): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1027)
后来发现用来充当背景的
pagefactory.setBgBitmap(BitmapFactory.decodeResource(
this.getResources(), R.drawable.bg));
这个图片太大了,改成小一点的图片,没有问题了。
另外查资料别人也提出用BitmapFactory.decodeFile()方法来加载,明天试试看~~~