Because I tried too much solution within 2 days, following is a one of the solution.
layout/ad_layout.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> </LinearLayout> AdPreference.java public class AdPreference extends Preference { public AdPreference(Context context, AttributeSet attrs, int defStyle) {super (context, attrs, defStyle);} public AdPreference(Context context, AttributeSet attrs) {super(context, attrs);} public AdPreference(Context context) {super(context);} @Override protected View onCreateView(ViewGroup parent) { // this will create the linear layout defined in ads_layout.xml View view = super.onCreateView(parent); // the context is a PreferenceActivity Activity activity = (Activity)getContext(); // Create the adView AdView adView = new AdView(activity, AdSize.BANNER, "< ad id >"); ((LinearLayout)view).addView(adView); // Initiate a generic request to load it with an ad AdRequest request = new AdRequest(); adView.loadAd(request); return view; } } add to current setting.xml <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/ android"> ... <com.xxxx.xxxx.AdPreference android:layout="@layout/ad_layout"/> ... </PreferenceScreen> -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en