I want implement admob native ads in one of my quote application which have recyclerview. I am learning programming in android and tried to find tutorial for native ads but there no where good tutorial available for implement native admob banner in recyclerview. Anyone have tried, Please give me some suggestion. Thanks
Asked
Active
Viewed 8,849 times
1 Answers
1
you should use NativeExpressAdView
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
tools:context="com.google.example.gms.ads.nativeexpressexample.MainActivity">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Hello World!" />
<com.google.android.gms.ads.NativeExpressAdView
ads:adSize="320x150"
ads:adUnitId="@string/ad_unit_id"
android:id="@+id/adView"
android:layout_height="wrap_content"
android:layout_width="wrap_content"></com.google.android.gms.ads.NativeExpressAdView>
</RelativeLayout>
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
NativeExpressAdView adView = (NativeExpressAdView) findViewById(R.id.adView);
adView.loadAd(new AdRequest.Builder().build());
}
}

sneha desai
- 886
- 1
- 11
- 19
-
1Why do we need NativeExpressAdView? In the doc there is nothing about it!? https://developers.google.com/mobile-ads-sdk/docs/dfp/android/native#prerequisites – Denny Weinberg Jul 04 '16 at 06:51
-
NativeExpressAdView deprecated – Pavel Poley Jan 22 '19 at 18:21