2012-07-02 52 views
0

的我在Tabhost以下異常與的ActivityGroup 我用下面的代碼的setContentView例外tabHost VM預算誤差的ActivityGroup

View viewToLoad = LayoutInflater.from(this.getParent()).inflate(R.layout.language, null); 
this.setContentView(viewToLoad); 

我有以下我的一些活動例外

01-28 16:26:23.550: E/dalvikvm-heap(2730): 768000-byte external allocation too large for this process. 
01-28 16:26:23.550: E/(2730): VM won't let us allocate 768000 bytes 
01-28 16:26:23.550: D/skia(2730): --- decoder->decode returned false 
01-28 16:26:23.558: D/AndroidRuntime(2730): Shutting down VM 
01-28 16:26:23.558: W/dalvikvm(2730): threadid=3: thread exiting with uncaught exception (group=0x4001b170) 
01-28 16:26:23.558: W/System.err(2730): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.milagemaster/com.milagemaster.Activity_Share}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown> 
01-28 16:26:23.566: W/System.err(2730):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496) 
01-28 16:26:23.566: W/System.err(2730):  at android.app.ActivityThread.startActivityNow(ActivityThread.java:2335) 
01-28 16:26:23.566: W/System.err(2730):  at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127) 
01-28 16:26:23.566: W/System.err(2730):  at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339) 
01-28 16:26:23.566: W/System.err(2730):  at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:648) 
01-28 16:26:23.566: W/System.err(2730):  at android.widget.TabHost.setCurrentTab(TabHost.java:320) 
01-28 16:26:23.566: W/System.err(2730):  at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:129) 
01-28 16:26:23.566: W/System.err(2730):  at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:379) 
01-28 16:26:23.566: W/System.err(2730):  at android.view.View.performClick(View.java:2364) 
01-28 16:26:23.566: W/System.err(2730):  at android.view.View.onTouchEvent(View.java:4179) 
01-28 16:26:23.566: W/System.err(2730):  at android.view.View.dispatchTouchEvent(View.java:3709) 
01-28 16:26:23.566: W/System.err(2730):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:851) 
01-28 16:26:23.566: W/System.err(2730):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:883) 
01-28 16:26:23.566: W/System.err(2730):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:883) 
01-28 16:26:23.566: W/System.err(2730):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:883) 
01-28 16:26:23.566: W/System.err(2730):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:883) 
01-28 16:26:23.574: W/System.err(2730):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:883) 
01-28 16:26:23.574: W/System.err(2730):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:883) 
01-28 16:26:23.574: W/System.err(2730):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:883) 
01-28 16:26:23.574: W/System.err(2730):  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659) 
01-28 16:26:23.574: W/System.err(2730):  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107) 
01-28 16:26:23.574: W/System.err(2730):  at android.app.Activity.dispatchTouchEvent(Activity.java:2061) 
01-28 16:26:23.574: W/System.err(2730):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643) 
01-28 16:26:23.574: W/System.err(2730):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1691) 
01-28 16:26:23.574: W/System.err(2730):  at android.os.Handler.dispatchMessage(Handler.java:99) 
01-28 16:26:23.574: W/System.err(2730):  at android.os.Looper.loop(Looper.java:123) 
01-28 16:26:23.574: W/System.err(2730):  at android.app.ActivityThread.main(ActivityThread.java:4363) 
01-28 16:26:23.574: W/System.err(2730):  at java.lang.reflect.Method.invokeNative(Native Method) 
01-28 16:26:23.574: W/System.err(2730):  at java.lang.reflect.Method.invoke(Method.java:521) 
01-28 16:26:23.574: W/System.err(2730):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 
01-28 16:26:23.574: W/System.err(2730):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
01-28 16:26:23.574: W/System.err(2730):  at dalvik.system.NativeStart.main(Native Method) 
01-28 16:26:23.574: W/System.err(2730): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown> 
01-28 16:26:23.589: W/System.err(2730):  at android.view.LayoutInflater.createView(LayoutInflater.java:513) 
01-28 16:26:23.589: W/System.err(2730):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
01-28 16:26:23.589: W/System.err(2730):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563) 
01-28 16:26:23.589: W/System.err(2730):  at android.view.LayoutInflater.inflate(LayoutInflater.java:385) 
01-28 16:26:23.589: W/System.err(2730):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 
01-28 16:26:23.589: W/System.err(2730):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 
01-28 16:26:23.589: W/System.err(2730):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198) 
01-28 16:26:23.589: W/System.err(2730):  at android.app.Activity.setContentView(Activity.java:1622) 
01-28 16:26:23.589: W/System.err(2730):  at com.milagemaster.Activity_Share.onCreate(Activity_Share.java:30) 
01-28 16:26:23.589: W/System.err(2730):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 
01-28 16:26:23.589: W/System.err(2730):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) 
01-28 16:26:23.589: W/System.err(2730):  ... 31 more 
01-28 16:26:23.589: W/System.err(2730): Caused by: java.lang.reflect.InvocationTargetException 
01-28 16:26:23.597: W/System.err(2730):  at android.widget.RelativeLayout.<init>(RelativeLayout.java:171) 
01-28 16:26:23.597: W/System.err(2730):  at java.lang.reflect.Constructor.constructNative(Native Method) 
01-28 16:26:23.597: W/System.err(2730):  at java.lang.reflect.Constructor.newInstance(Constructor.java:446) 
01-28 16:26:23.597: W/System.err(2730):  at android.view.LayoutInflater.createView(LayoutInflater.java:500) 
01-28 16:26:23.597: W/System.err(2730):  ... 41 more 
01-28 16:26:23.597: W/System.err(2730): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget 
01-28 16:26:23.613: W/System.err(2730):  at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) 
01-28 16:26:23.613: W/System.err(2730):  at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:447) 
01-28 16:26:23.613: W/System.err(2730):  at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323) 
01-28 16:26:23.613: W/System.err(2730):  at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697) 
01-28 16:26:23.613: W/System.err(2730):  at android.content.res.Resources.loadDrawable(Resources.java:1705) 
01-28 16:26:23.613: W/System.err(2730):  at android.content.res.TypedArray.getDrawable(TypedArray.java:548) 
01-28 16:26:23.613: W/System.err(2730):  at android.view.View.<init>(View.java:1850) 
01-28 16:26:23.613: W/System.err(2730):  at android.view.View.<init>(View.java:1799) 
01-28 16:26:23.613: W/System.err(2730):  at android.view.ViewGroup.<init>(ViewGroup.java:283) 
01-28 16:26:23.613: W/System.err(2730):  ... 45 more 

這裏是我的標籤頁活動的xml文件

<LinearLayout 
    android:id="@+id/lLayoutHome" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <TabHost 
     android:id="@android:id/tabhost" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_marginTop="0dip" 
     android:background="@drawable/title" > 

     <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:orientation="vertical" > 

      <FrameLayout 
       android:id="@android:id/tabcontent" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:layout_weight="1" /> 

      <ImageView 
       android:id="@+id/imageLine" 
       android:layout_width="fill_parent" 
       android:layout_height="2dp" 
       android:background="@color/mileage" /> 

      <TabWidget 
       android:id="@android:id/tabs" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="bottom" 
       android:tabStripEnabled="false" /> 
     </LinearLayout> 
    </TabHost> 
</LinearLayout> 

,這裏是在XML文件中我的活動

<LinearLayout 
    android:id="@+id/lnrTitle" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@color/white" 
    android:orientation="vertical" > 

    <com.milagemaster.utility.Header 
     android:id="@+id/header" 
     android:layout_width="fill_parent" 
     android:layout_height="50dp" /> 

    <RelativeLayout 
     android:id="@+id/relativeHome" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/title" > 

     <TextView 
      android:id="@+id/txtAddData" 
      style="@style/TitleTextAppearance" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:layout_centerVertical="true" 
      android:text="@string/adddata" 
      android:textAppearance="?android:attr/textAppearanceLarge" 
      android:textColor="@color/black" /> 
    </RelativeLayout> 
</LinearLayout> 

<RelativeLayout 
    android:id="@+id/relativeMainAdd" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/lnrTitle" > 

    <ImageView 
     android:id="@+id/imgShadow" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/shadow_title" /> 

    <RelativeLayout 
     android:id="@+id/relativeAddData" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/relativeSpinner" 
     android:layout_marginTop="5dp" > 

     <LinearLayout 
      android:id="@+id/relativetitle" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="5dp" 
      android:layout_marginRight="5dp" 
      android:background="@drawable/top_blue" > 

      <TextView 
       android:id="@+id/txtSelVehicle" 
       android:layout_width="80dp" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_vertical" 
       android:layout_marginLeft="10dp" 
       android:layout_marginRight="10dp" 
       android:ellipsize="end" 
       android:gravity="center_horizontal" 
       android:text="@string/vehcile" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:textColor="@color/black" 
       android:textSize="16dp" /> 

      <Spinner 
       android:id="@+id/spnSelectVehicle" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_vertical" 
       android:layout_marginRight="5dp" 
       android:background="@drawable/dropdown" 
       android:paddingLeft="10dp" /> 
     </LinearLayout> 

     <ScrollView 
      android:id="@+id/scroll_barsMain" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/relativetitle" 
      android:layout_marginBottom="50dp" 
      android:layout_marginLeft="5dp" 
      android:layout_marginRight="5dp" 
      android:background="@drawable/box_middle_white" 
      android:isScrollContainer="true" 
      android:scrollbarAlwaysDrawVerticalTrack="true" 
      android:scrollbars="vertical" > 

      <LinearLayout 
       android:id="@+id/linearLayout1" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/relativetitle" 
       android:orientation="vertical" > 

       <LinearLayout 
        android:id="@+id/linearLayout2" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="5dp" 
        android:layout_marginRight="5dp" 
        android:layout_marginTop="5dp" > 

        <TextView 
         android:id="@+id/txtAddGal" 
         android:layout_width="120dp" 
         android:layout_height="wrap_content" 
         android:layout_gravity="center_vertical" 
         android:text="@string/costpergal" 
         android:textColor="@color/black" 
         android:textSize="14sp" /> 

        <LinearLayout 
         android:id="@+id/linearLayout3" 
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         android:layout_gravity="center_vertical" > 

         <EditText 
          android:id="@+id/edtAddGal" 
          android:layout_width="80dp" 
          android:layout_height="30dp" 
          android:background="@drawable/background_content" 
          android:ellipsize="end" 
          android:hint="@string/cost" 
          android:maxLength="10" 
          android:numeric="integer|decimal" 
          android:singleLine="true" 
          android:textColor="@color/mileage" 
          android:textColorHint="@color/mileage" 
          android:textSize="14sp" /> 

         <TextView 
          android:id="@+id/txtCurrencyGal" 
          android:layout_width="fill_parent" 
          android:layout_height="wrap_content" 
          android:layout_gravity="center_vertical" 
          android:textColor="@color/mileage" 
          android:textSize="14sp" /> 
        </LinearLayout> 
       </LinearLayout> 

       <LinearLayout 
        android:id="@+id/linearLayout2" 
        android:layout_width="fill_parent" 
        android:layout_height="30dp" 
        android:layout_marginLeft="5dp" 
        android:layout_marginRight="5dp" > 

        <TextView 
         android:id="@+id/txtAddGallons" 
         android:layout_width="120dp" 
         android:layout_height="wrap_content" 
         android:layout_gravity="center_vertical" 
         android:text="@string/gallonsAdded" 
         android:textColor="@color/black" 
         android:textSize="14sp" /> 

        <EditText 
         android:id="@+id/edtAddGallons" 
         android:layout_width="fill_parent" 
         android:layout_height="30dp" 
         android:layout_gravity="center_vertical" 
         android:background="@drawable/background_content" 
         android:ellipsize="end" 
         android:hint="@string/gallonsAdded" 
         android:maxLength="10" 
         android:numeric="integer|decimal" 
         android:singleLine="true" 
         android:textColor="@color/mileage" 
         android:textColorHint="@color/mileage" 
         android:textSize="14sp" /> 
       </LinearLayout> 

       <LinearLayout 
        android:id="@+id/linearLayout2" 
        android:layout_width="fill_parent" 
        android:layout_height="30dp" 
        android:layout_marginLeft="5dp" 
        android:layout_marginRight="5dp" > 

        <TextView 
         android:id="@+id/txtTotalCost" 
         android:layout_width="120dp" 
         android:layout_height="wrap_content" 
         android:layout_gravity="center_vertical" 
         android:text="@string/tcost" 
         android:textColor="@color/black" 
         android:textSize="14sp" /> 

        <LinearLayout 
         android:id="@+id/linearLayout3" 
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         android:layout_gravity="center_vertical" > 

         <EditText 
          android:id="@+id/edtTotalCost" 
          android:layout_width="80dp" 
          android:layout_height="30dp" 
          android:layout_gravity="center_vertical" 
          android:background="@drawable/background_content" 
          android:ellipsize="end" 
          android:hint="@string/tcost" 
          android:maxLength="10" 
          android:numeric="integer|decimal" 
          android:singleLine="true" 
          android:textColor="@color/mileage" 
          android:textColorHint="@color/mileage" 
          android:textSize="14sp" > 

          <requestFocus /> 
         </EditText> 

         <TextView 
          android:id="@+id/txtCurrencyTotal" 
          android:layout_width="fill_parent" 
          android:layout_height="wrap_content" 
          android:layout_gravity="center_vertical" 
          android:textColor="@color/mileage" 
          android:textSize="14sp" /> 
        </LinearLayout> 
       </LinearLayout> 

       <LinearLayout 
        android:id="@+id/linearLayout2" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="5dp" 
        android:layout_marginRight="5dp" 
        android:orientation="horizontal" > 

        <TextView 
         android:id="@+id/txtFilledTank" 
         android:layout_width="120dp" 
         android:layout_height="wrap_content" 
         android:text="@string/fiiledTank" 
         android:textColor="@color/black" 
         android:textColorHint="@color/mileage" 
         android:textSize="14sp" /> 

        <!-- 
         <ToggleButton 
         android:id="@+id/tgbtnFillTank" 
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         android:layout_gravity="center_vertical" 
         android:background="@drawable/full_off" 
         android:textOff="" 
         android:textOn="" /> 

        --> 

        <RadioGroup 
         android:id="@+id/tgbtnFillTank" 
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         android:orientation="horizontal" > 

         <RadioButton 
          android:id="@+id/tankfull" 
          android:layout_width="wrap_content" 
          android:layout_height="30dp" 
          android:button="@drawable/button_radio" 

          android:paddingLeft="30dp" 
          android:singleLine="true" 
          android:text="@string/yes" 
          android:checked="true" 
          android:textColor="@color/mileage" 
          android:textSize="12sp" /> 

         <RadioButton 
          android:id="@+id/tankNotFull" 
          android:layout_width="wrap_content" 
          android:layout_height="30dp" 
          android:layout_marginLeft="20dp" 
          android:button="@drawable/button_radio" 

          android:paddingLeft="30dp" 
          android:singleLine="true" 
          android:text="@string/no" 
          android:textColor="@color/mileage" 
          android:textSize="12sp" /> 
        </RadioGroup> 
       </LinearLayout> 

       <LinearLayout 
        android:id="@+id/linearLayout2" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="5dp" 
        android:layout_marginRight="5dp" > 

        <TextView 
         android:id="@+id/txtOdometerset" 
         android:layout_width="120dp" 
         android:layout_height="wrap_content" 
         android:text="@string/odometersetup" 
         android:textColor="@color/black" 
         android:textSize="14sp" /> 

        <RadioGroup 
         android:id="@+id/radioGroup" 
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" > 

         <RadioButton 
          android:id="@+id/rdbManually" 
          android:layout_width="fill_parent" 
          android:layout_height="30dp" 
          android:button="@drawable/button_radio" 
          android:checked="false" 
          android:paddingLeft="40dp" 
          android:singleLine="true" 
          android:text="@string/totalmileage" 
          android:textColor="@color/mileage" 
          android:textSize="12sp" /> 

         <RadioButton 
          android:id="@+id/rdbTrip" 
          android:layout_width="fill_parent" 
          android:layout_height="30dp" 
          android:button="@drawable/button_radio" 
          android:paddingLeft="40dp" 
          android:singleLine="true" 
          android:text="@string/tripmielage" 
          android:textColor="@color/mileage" 
          android:textSize="12sp" /> 
        </RadioGroup> 
       </LinearLayout> 

       <LinearLayout 
        android:id="@+id/linearLayout2" 
        android:layout_width="fill_parent" 
        android:layout_height="30dp" 
        android:layout_marginLeft="5dp" 
        android:layout_marginRight="5dp" > 

        <TextView 
         android:id="@+id/txtOdometer" 
         android:layout_width="120dp" 
         android:layout_height="wrap_content" 
         android:layout_gravity="center_vertical" 
         android:text="@string/osometer" 
         android:textColor="@color/black" 
         android:textSize="14sp" /> 

        <EditText 
         android:id="@+id/edtOdometer" 
         android:layout_width="fill_parent" 
         android:layout_height="30dp" 
         android:layout_gravity="center_vertical" 
         android:background="@drawable/background_content" 
         android:ellipsize="end" 
         android:hint="@string/odometerreading" 
         android:maxLength="10" 
         android:numeric="integer|decimal" 
         android:singleLine="true" 
         android:textColor="@color/mileage" 
         android:textColorHint="@color/mileage" 
         android:textSize="14sp" /> 
       </LinearLayout> 

       <LinearLayout 
        android:id="@+id/linearLayout2" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="5dp" 
        android:layout_marginRight="5dp" > 

        <TextView 
         android:id="@+id/txtNote" 
         android:layout_width="120dp" 
         android:layout_height="30dp" 
         android:layout_gravity="center_vertical" 
         android:text="@string/note" 
         android:textColor="@color/black" 
         android:textSize="14sp" /> 

        <EditText 
         android:id="@+id/editNote" 
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         android:layout_gravity="center_vertical" 
         android:background="@drawable/background_content" 
         android:ellipsize="end" 
         android:hint="@string/notefillup" 
         android:imeOptions="actionDone" 
         android:maxLength="200" 
         android:singleLine="true" 
         android:textColor="@color/mileage" 
         android:textColorHint="@color/mileage" 
         android:textSize="14sp" /> 
       </LinearLayout> 
+0

發表您的佈局XML過,那裏的錯誤似乎是'錯誤充氣類' – Rajesh

+0

我沒有收到關於第一次這個錯誤,當我在應用程序導航3〜4次這樣的錯誤出現 – bindal

回答

0

檢查你的XML文件。因爲可能是它被XML FIL

導致產生的原因:了java.lang.RuntimeException:無法啓動活動ComponentInfo {com.milagemaster/com.milagemaster.Activity_home}:android.view.InflateException:二進制XML文件中的行# 2:錯誤膨脹類 所以,發佈您的XML佈局。 感謝