ボタンをクリックすると、ビュー フリッパー xml が読み込まれます。この xml はすべてのデバイスで適切に機能しますが、Google Nexus One デバイスで CRASH を報告します。また、クラッシュせずに実行されることもあります。以下は私のXMLです:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/object_mainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/obj_top_bar_RL"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip" >
<Button
android:id="@+id/home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="@drawable/home" />
<Button
android:id="@+id/sound"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/sound" />
<Button
android:id="@+id/settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="@drawable/setting" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/obj_bottom_bar_RL"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<Button
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="25dip"
android:background="@drawable/next" />
<Button
android:id="@+id/prev"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="25dip"
android:background="@drawable/previous" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/prev" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="a1504ac5c4238ef"
ads:loadAdOnCreate="true" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/obj_bottom_bar_RL"
android:layout_below="@id/obj_top_bar_RL"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" >
<ViewFlipper
android:id="@+id/flipper_object"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/object_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/object_1" />
<ImageView
android:id="@+id/object_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/object_2" />
<ImageView
android:id="@+id/object_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/object_3" />
</ViewFlipper>
</FrameLayout>
</RelativeLayout>
ログは次のとおりです。
Failed to inflate
android.view.InflateException: Binary XML file line #118: Error inflating class <unknown>
android.view.LayoutInflater.createView(LayoutInflater.java:518)
com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
android.view.LayoutInflater.inflate(LayoutInflater.java:408)
android.view.LayoutInflater.inflate(LayoutInflater.java:320)
android.view.LayoutInflater.inflate(LayoutInflater.java:276)
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:212)
android.app.Activity.setContentView(Activity.java:1657)
com.flash.object.ObjectActivity.onCreate(ObjectActivity.java:78)
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1722)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
android.app.ActivityThread.access$1500(ActivityThread.java:123)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:123)
android.app.ActivityThread.main(ActivityThread.java:3839)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:507)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
dalvik.system.NativeStart.main(Native Method)
10-09 15:58:25.201: Caused by: java.lang.reflect.InvocationTargetException
java.lang.reflect.Constructor.constructNative(Native Method)
java.lang.reflect.Constructor.newInstance(Constructor.java:415)
android.view.LayoutInflater.createView(LayoutInflater.java:505)
10-09 15:58:25.201: ... 24 more
10-09 15:58:25.201: Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460)
android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
android.content.res.Resources.loadDrawable(Resources.java:1782)
android.content.res.TypedArray.getDrawable(TypedArray.java:601)
android.view.View.<init>(View.java:1967)
android.widget.ImageView.<init>(ImageView.java:112)
android.widget.ImageView.<init>(ImageView.java:108)
10-09 15:58:25.201: ... 27 more
誰かが私を提案できるかどうか教えてください.. !!! :(