4

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

Rajubhai Rathod
  • 501
  • 2
  • 5
  • 14

1 Answers1

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