I have an app that is ad supported. As a result when the screen is rotated the ad persists. I would like to be able to make the ad only exist when the phone is in portrait and not in landscape. Do I need to declare a separate landscape xml or is there a different way to do this? If I need to declare a landscape xml how do I handle that in java?
Here is the relevant xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:screenOrientation="portrait"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=" "
android:id="@+id/textView"
android:layout_centerHorizontal="true" android:layout_gravity="center_horizontal"/>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/pic"
android:layout_weight="1"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:adjustViewBounds="true"
android:scaleType="centerCrop"/>
</RelativeLayout>
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="4"
ads:adSize="BANNER"
android:layout_centerHorizontal="true"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/pic"
>
//a bunch of buttons
</LinearLayout>
Thanks!
Update Here is the logcat for when the app crashes after implementing layout-land folder and removing the element I don't want, aka the adview .txt