in Android Studio
Google Adsense is an advertising network owned by Google. It is the largest ad network in the world. Adsense allows publishers in the Google Network of content sites to serve automatic text, image, video, or interactive media advertisements, that are targeted to site content and audience. Those interested in integrating Adsense into their websites can do so through self-service or by working with a Google Partner.
In this article we will be discussing how to insert banner ads into web view in android studio.
Android studio comes with a built in tool called WebView that allows us to display web pages within our app. By using this tool we can easily add banner ads into our app without having to code anything.
To do this, first create a new project in android studio and name it whatever you want. I will be naming my project “Banner Ads”. Once the project is created, open up the main activity java file and add the following code:
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Find the web view in activity_main layout
WebView myWebView = (WebView) findViewById(R.id