タイトル画面に adMob を追加することができました。このレイアウトは *.xml ファイルに記述されています。
setContentView(R.layout.main);
AdView adView = (AdView)findViewById(R.id.ad);
adView.requestFreshAd();
main.xml には以下が含まれます。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/de.xazen.tictactoe"
android:background="@drawable/title"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.admob.android.ads.AdView
android:id="@+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
myapp:backgroundColor="#000000"
myapp:primaryTextColor="#FFFFFF"
myapp:secondaryTextColor="#CCCCCC"
/>
</RelativeLayout>
ゲーム自体はTttviewで書かれています。
public class TttView extends View
アクティビティ Game.java は TttView のインスタンスを作成し、setcontent(tttView) を使用してレイアウトとして使用します。
public class Game extends Activity{
private TttView tttView;
.
.
.
setContentView(tttView);
}
ゲーム自体に adMob を追加するにはどうすればよいですか?