【发布时间】:2014-02-15 05:10:07
【问题描述】:
如何释放 1 项活动中使用的资源? 所以我为每个布局获得了 3 个布局和活动,但问题是当我在这些活动之间切换时,我的应用程序崩溃了,我得到了这个:
自从我将添加添加到我的应用程序后,我就开始收到此错误。 我的整个 logcat http://i.imgur.com/t5G94dC.png
XML 布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#000000" >
<ImageButton
android:id="@+id/dugme2"
android:layout_width="150dp"
android:layout_height="90dp"
android:layout_alignBottom="@+id/dugme1"
android:layout_alignParentRight="true"
android:background="#0000"
android:onClick="onClick"
android:scaleType="fitXY"
android:src="@drawable/dragunov" />
<ImageButton
android:id="@+id/dugme5"
android:layout_width="150dp"
android:layout_height="90dp"
android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/dugme6"
android:background="#0000"
android:onClick="onClick"
android:scaleType="fitXY"
android:src="@drawable/scout" />
<SeekBar
android:id="@+id/seekSnipers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:progressDrawable="@drawable/red_scrubber_progress"
android:thumb="@drawable/red_scrubber_control" />
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="ID"
ads:loadAdOnCreate="true" >
</com.google.ads.AdView>
</RelativeLayout>
除了资源和 ID 不同之外,其他布局也几乎相同。 每种布局中的广告代码都是相同的。
【问题讨论】:
-
请分享加载失败的activity的xml布局。
-
不是 1 个布局/活动加载失败,基本上所有活动都可能崩溃/加载失败。它是这样的:菜单>活动1>菜单>活动2>菜单>活动3>菜单:我打开的任何下一个布局/活动都会崩溃
-
此错误表示您的 XML 布局中有一个或多个错误,如果您需要帮助,请发布您的 xml 代码;)
-
我在上面添加了 XML 布局。
标签: android resources release destroy