I am an beginner and In my app i need to change admob banner unit id from edittext. I really don't know how can i do this. Currently this is the AdView xml code :
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="75dp"/>
and this is how i am setting the adview code :
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
id = editText.getEditableText().toString();
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId(id);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
}
});
how can i retrive and set the id from edittext and show the banner ad ?