Skip to content

Webview With Splash Screen

Splash Screen

Splash Screen Xml layout file

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:app="http://schemas.android.com/apk/res-auto"

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical"

    tools:context=".SplashActivity"
    android:background="@color/ic_launcher_background"
    >


    <ImageView

        android:layout_width="match_parent"

        android:layout_height="300dp"

        android:src="@drawable/logo"

        android:scaleType="centerCrop"

        android:padding="50dp"

        android:layout_marginTop="220dp"/>

    <ProgressBar

        android:layout_width="220dp"

        android:layout_height="10dp"

        android:layout_gravity="center_horizontal"

        style="?android:attr/progressBarStyleHorizontal"

        android:max="100"

        android:indeterminate="true"

        android:progress="0"

        android:layout_marginTop="100dp"


        />

</LinearLayout>

Splash screen Java layout with in App Update imidiate

package com.example.facefoftvfacefof;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;


import android.content.Intent;

import android.content.IntentSender;
import android.os.Bundle;

import android.util.Log;
import android.view.Window;

import android.view.WindowManager;
import android.widget.Toast;

import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.android.play.core.appupdate.AppUpdateInfo;
import com.google.android.play.core.appupdate.AppUpdateManager;
import com.google.android.play.core.appupdate.AppUpdateManagerFactory;
import com.google.android.play.core.appupdate.AppUpdateOptions;
import com.google.android.play.core.install.model.AppUpdateType;
import com.google.android.play.core.install.model.UpdateAvailability;
import com.google.android.ump.ConsentInformation;


public class SplashActivity extends AppCompatActivity {
    private int REQUEST_CODE = 11;


    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);


        Window window = getWindow() ;


        window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

        setContentView(R.layout.activity_splash);


        //In-App Udpates Implementation (1st part)------------------------------------------------------
        AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(SplashActivity.this);
        Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
        appUpdateInfoTask.addOnSuccessListener(new OnSuccessListener<AppUpdateInfo>() {
            @Override
            public void onSuccess(AppUpdateInfo result) {
                if (result.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
                        & result.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)){
                    try {
                        appUpdateManager.startUpdateFlowForResult(result,AppUpdateType.IMMEDIATE,SplashActivity.this,REQUEST_CODE);
                    } catch (IntentSender.SendIntentException e) {
                        throw new RuntimeException(e);
                    }
                }

            }
        });




        Thread splashTread = new Thread(){
            @Override

            public void run() {

                try {

                    sleep(1000);

                    startActivity(new Intent(getApplicationContext(), WelcomeActivity.class));

                    finish();

                } catch (InterruptedException e) {

                    e.printStackTrace();

                }


                super.run();

            }

        };


        splashTread.start();


    }

    //In-App Udpates Implementation (2nd part)------------------------------------------------------
    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == REQUEST_CODE) {
            Toast.makeText(SplashActivity.this, "Start Download", Toast.LENGTH_SHORT).show();
            if (requestCode != RESULT_OK) {
                Log.d("mmm", "Update Fail" + resultCode);
            }
        }
    }

}

Webview Activity With Progress Bar And Swipe Refresh

Webview Activity XML Layout

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Webview10Activity">

    <RelativeLayout
        android:layout_marginBottom="2dp"
        android:layout_above="@+id/banner"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
            android:id="@+id/swipeRefreshLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent">


            <WebView
                android:id="@+id/webView"
                android:layout_width="match_parent"
                android:layout_height="match_parent" >
            </WebView>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:text="No internet connection, please try again."
                android:textSize="18sp"
                android:visibility="gone" />

        </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

        <ProgressBar
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:id="@+id/progressBar"
            android:visibility="gone"
            android:indeterminate="false"
            android:max="100"
            android:background="@drawable/progress_bar_bg"
            android:layout_centerInParent="true"/>


    </RelativeLayout>

    <LinearLayout
        android:id="@+id/banner"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        >


        <com.google.android.gms.ads.AdView
            xmlns:ads="http://schemas.android.com/apk/res-auto"
            android:id="@+id/adView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_alignParentBottom="true"
            ads:adSize="BANNER"
            ads:adUnitId="@string/banner_ad_unit_id10">
        </com.google.android.gms.ads.AdView>

    </LinearLayout>

</RelativeLayout>

Web View Java Files With intrestital Ads and Internet Check

package com.example.facefoftvfacefof;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;

import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.WindowMetrics;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ProgressBar;

import com.google.android.gms.ads.AdError;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.FullScreenContentCallback;
import com.google.android.gms.ads.LoadAdError;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.initialization.InitializationStatus;
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
import com.google.android.gms.ads.interstitial.InterstitialAd;
import com.google.android.gms.ads.interstitial.InterstitialAdLoadCallback;

public class Webview10Activity extends App {

    private AdView mAdView;
    private SwipeRefreshLayout swipeRefreshLayout;
    private WebView webView;
    private InterstitialAd mInterstitialAd;

    ProgressBar progressBar;
    private boolean webViewLoaded = false;
    private boolean internetCheckRunning = false;


    boolean isActive = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_webview10);

        isActive = true;

        MobileAds.initialize(this, new OnInitializationCompleteListener() {
            @Override
            public void onInitializationComplete(InitializationStatus initializationStatus) {
            }
        });

        mAdView = findViewById(R.id.adView);
        AdRequest adRequest = new AdRequest.Builder().build();
        mAdView.loadAd(adRequest);


        loadAds();
        showAds();

        webView = findViewById(R.id.webView);
        progressBar = findViewById(R.id.progressBar);
        swipeRefreshLayout = findViewById(R.id.swipeRefreshLayout);


        // Configure WebView settings
        WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true);

        // Initialize WebChromeClient to handle full-screen video
        webView.setWebChromeClient(new WebChromeClient() {

            View fullscreen = null;

            @Override
            public void onShowCustomView(View view, CustomViewCallback callback) {
                webView.setVisibility(View.GONE);

                if (fullscreen != null) {
                    ((FrameLayout) getWindow().getDecorView()).removeView(fullscreen);
                }

                fullscreen = view;
                ((FrameLayout) getWindow().getDecorView()).addView(fullscreen, new FrameLayout.LayoutParams(-1, -1));
                fullscreen.setVisibility(View.VISIBLE);
            }

            @Override
            public void onHideCustomView() {
                fullscreen.setVisibility(View.GONE);
                webView.setVisibility(View.VISIBLE);
            }


            @Override
            public void onProgressChanged(WebView view, int newProgress) {
                // Update the progress bar
                progressBar.setProgress(newProgress);
                if (newProgress == 100) {
                    // Page is loaded, stop progress bar
                    progressBar.setVisibility(View.GONE);
                    swipeRefreshLayout.setRefreshing(false);
                    webViewLoaded();

                } else {
                    progressBar.setVisibility(View.VISIBLE);

                } // Check internet connection while the progress bar is progressing
                if (!internetCheckRunning) {
                    checkInternetWhileProgressing();
                }
            }
        });

        // Handle clicks within the WebView
        webView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                if (!isNetworkAvailable()) {
                    // No internet connection, show a dialog box to retry
                    showNoInternetDialog();
                    return true; // Cancel the URL loading
                }
                return super.shouldOverrideUrlLoading(view, url);
            }
        });

        // Swipe-to-refresh listener
        swipeRefreshLayout.setOnRefreshListener(() -> {
            // Check for internet connectivity before reloading
            if (isNetworkAvailable()) {
                // Internet connection is available, reload the current URL
                progressBar.setVisibility(View.VISIBLE); // Re-enable progress bar
                webView.reload();
            } else {
                // No internet connection, show a dialog box to retry
                showNoInternetDialog();
                swipeRefreshLayout.setRefreshing(false);
            }
        });

        // Load the web page
        loadWebPage("https://facefof.net");
    }

    // Helper method to load the web page
    private void loadWebPage(String url) {
        // Check for internet connectivity before loading the web page
        if (!isNetworkAvailable()) {
            // No internet connection, show a dialog box to retry
            showNoInternetDialog();
        } else {

            // Internet connection is available, load the web page
            progressBar.setVisibility(View.VISIBLE);
            webView.loadUrl(url);
        }
    }

    // Helper method to check for internet connectivity
    private boolean isNetworkAvailable() {
        ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
        return activeNetworkInfo != null && activeNetworkInfo.isConnected();
    }

    // Helper method to show a dialog for "No internet connection, please try again"
    private void showNoInternetDialog() {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("No Internet Connection");
        builder.setMessage("Please check your internet connection and try again.");
        builder.setPositiveButton("Retry", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                loadWebPage(webView.getUrl());
            }
        });
        builder.setCancelable(false);
        builder.show();
    }

    // Helper method to check internet connection while the progress bar is progressing
    private void checkInternetWhileProgressing() {
        internetCheckRunning = true;
        final Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (!isNetworkAvailable()) {
                    // No internet connection, show a dialog box
                    showNoInternetDialog();
                }
                internetCheckRunning = false;
            }
        }, 500); // Delay for checking internet connection
    }

    // This method is called when the WebView is loaded
    private void webViewLoaded() {
        // Perform any actions you want when the WebView is loaded here

    }


    private void showAds() {

        if (isActive){

            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {

                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {

                            if (isActive) {

                                if (mInterstitialAd != null) {
                                    mInterstitialAd.show(Webview10Activity.this);
                                    mInterstitialAd.setFullScreenContentCallback(new FullScreenContentCallback() {
                                        @Override
                                        public void onAdDismissedFullScreenContent() {
                                            super.onAdDismissedFullScreenContent();
                                            mInterstitialAd = null;
                                            loadAds();
                                            showAds();
                                        }

                                        @Override
                                        public void onAdFailedToShowFullScreenContent(@NonNull AdError adError) {
                                            super.onAdFailedToShowFullScreenContent(adError);
                                            mInterstitialAd = null;
                                            loadAds();
                                            showAds();
                                        }
                                    });

                                } else {
                                    showAds();


                                }


                            }

                        }
                    });


                }
            },300000);

        }



    }

    @Override
    protected void onStop() {
        super.onStop();
        isActive = false;
    }

    private void loadAds() {

        AdRequest adRequest = new AdRequest.Builder().build();

        InterstitialAd.load(this,getString(R.string.interstitital_ad_unit_id10), adRequest,
                new InterstitialAdLoadCallback() {
                    @Override
                    public void onAdLoaded(@NonNull InterstitialAd interstitialAd) {
                        // The mInterstitialAd reference will be null until
                        // an ad is loaded.
                        mInterstitialAd = interstitialAd;
                    }

                    @Override
                    public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
                        // Handle the error
                        mInterstitialAd = null;
                    }
                });

    }

    // Override onBackPressed to handle WebView facefoftvfacefof
    @Override
    public void onBackPressed() {
        if (webView.canGoBack()) {
            webView.goBack();

        } else {
            super.onBackPressed();
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        webView.destroy();
    }

}



Create Xml files in drawable as progress_bar_bg

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Background color with rounded corners -->
    <item android:id="@android:id/background">
        <shape>
            <solid android:color="#FFC107"/> <!-- Set the desired background color here -->
            <corners android:radius="350dp"/><!-- Set the radius to make it rounded -->

        </shape>

    </item>
    <!-- Background image -->
    <item>
        <bitmap
            android:src="@drawable/circlefacefof" /> <!-- Set the desired background image here -->
    </item>
    <!-- Progress color (you can customize this as well) -->
    <item android:id="@android:id/progress">
        <clip>
            <shape>
                <solid android:color="#EA0000"/> <!-- Set the progress color here -->
            </shape>
        </clip>
    </item>
</layer-list>

Create A WelcomeActivity

Welcome Activity XML Files Code

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout

    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@color/black"
    tools:context=".WelcomeActivity">

    <VideoView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/welcomevideo"
        android:layout_alignParentTop="true"
        android:layout_alignParentBottom="true"
        />


    <Button
        android:id="@+id/welcomebutton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_alignParentBottom="true"
        android:text="Get Start !"
        android:layout_marginBottom="40dp"
        android:background="@drawable/custom_button_bg"

        />




</RelativeLayout>

Welcome Activity Java Code with consent form admob GDPR

package com.example.facefoftvfacefof;

import static android.content.ContentValues.TAG;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;

import android.Manifest;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.VideoView;

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.FullScreenContentCallback;
import com.google.android.gms.ads.LoadAdError;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.initialization.InitializationStatus;
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
import com.google.android.gms.ads.interstitial.InterstitialAd;
import com.google.android.gms.ads.interstitial.InterstitialAdLoadCallback;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.android.play.core.appupdate.AppUpdateInfo;
import com.google.android.play.core.appupdate.AppUpdateManager;
import com.google.android.play.core.appupdate.AppUpdateManagerFactory;
import com.google.android.play.core.install.model.AppUpdateType;
import com.google.android.play.core.install.model.UpdateAvailability;
import com.google.android.ump.ConsentForm;
import com.google.android.ump.ConsentInformation;
import com.google.android.ump.ConsentRequestParameters;
import com.google.android.ump.UserMessagingPlatform;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.messaging.FirebaseMessaging;

public class WelcomeActivity extends App {


    Button welcomebutton;
    VideoView welcomevideo;
    private InterstitialAd mInterstitialAd;
    private ConsentInformation consentInformation;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);



        MobileAds.initialize(this, new OnInitializationCompleteListener() {
            @Override
            public void onInitializationComplete(InitializationStatus initializationStatus) {
            }
        });

        // Set tag for under age of consent. false means users are not under age
        // of consent.
        ConsentRequestParameters params = new ConsentRequestParameters
                .Builder()
                .setTagForUnderAgeOfConsent(false)
                .build();

        consentInformation = UserMessagingPlatform.getConsentInformation(this);
        consentInformation.requestConsentInfoUpdate(
                this,
                params,
                (ConsentInformation.OnConsentInfoUpdateSuccessListener) () -> {

                    UserMessagingPlatform.loadAndShowConsentFormIfRequired(
                            this,
                            (ConsentForm.OnConsentFormDismissedListener) loadAndShowError -> {
                                if (loadAndShowError != null) {
                                    // Consent gathering failed.
                                    Log.w(TAG, String.format("%s: %s",
                                            loadAndShowError.getErrorCode(),
                                            loadAndShowError.getMessage()));
                                }

                                // Consent has been gathered.
                            }
                    );

                    // TODO: Load and show the consent form.
                },
                (ConsentInformation.OnConsentInfoUpdateFailureListener) requestConsentError -> {
                    // Consent gathering failed.
                    Log.w(TAG, String.format("%s: %s",
                            requestConsentError.getErrorCode(),
                            requestConsentError.getMessage()));
                });


        setAds();

        welcomebutton = findViewById(R.id.welcomebutton);
        welcomebutton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (mInterstitialAd!=null){
                    mInterstitialAd.show(WelcomeActivity.this);

                    mInterstitialAd.setFullScreenContentCallback(new FullScreenContentCallback() {
                        @Override
                        public void onAdDismissedFullScreenContent() {

                            super.onAdDismissedFullScreenContent();
                            startActivity(new Intent(WelcomeActivity.this, MainActivity.class));
                            mInterstitialAd = null;
                            setAds();
                        }
                    });

                }

                else {

                    startActivity(new Intent(WelcomeActivity.this, MainActivity.class));

                }
            }


        });

        welcomevideo=findViewById(R.id.welcomevideo);
        Uri uri=Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.bg_videomp4);
        welcomevideo.setVideoURI(uri);
        welcomevideo.start();

        welcomevideo.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mediaPlayer) {
                mediaPlayer.setLooping(true);


            }
        });




    }

    @Override
    public void onBackPressed() {
        AlertDialog.Builder alertDialog = new AlertDialog.Builder(WelcomeActivity.this);
        alertDialog.setTitle("Exit App");
        alertDialog.setMessage("Do you want to exit app?");
        alertDialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                finishAffinity();

            }
        });
        alertDialog.setNegativeButton("No", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                dialogInterface.dismiss();
            }
        });
        alertDialog.show();

    }

    @Override
    protected void onPostResume() {
        welcomevideo.resume();
        super.onPostResume();
    }

    @Override
    protected void onStart() {
        welcomevideo.start();
        super.onStart();
    }

    @Override
    protected void onPause() {
        welcomevideo.suspend();
        super.onPause();
    }

    @Override
    protected void onDestroy() {
        welcomevideo.stopPlayback();
        super.onDestroy();
    }

    public void setAds(){

        AdRequest adRequest = new AdRequest.Builder().build();

        InterstitialAd.load(this,getString(R.string.interstitital_ad_unit_idwelcome), adRequest,
                new InterstitialAdLoadCallback() {
                    @Override
                    public void onAdLoaded(@NonNull InterstitialAd interstitialAd) {
                        // The mInterstitialAd reference will be null until
                        // an ad is loaded.
                        mInterstitialAd = interstitialAd;
                    }

                    @Override
                    public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
                        // Handle the error
                        mInterstitialAd = null;
                    }
                });

    }

}

Example of String id ads admob and other

 <string name="banner_ad_unit_id1">ca-app-pub-3940256099942544/6300978111 </string>

Rewarded ads in button

Xml Layout with 10 button

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center"
    android:background="@color/black"
    tools:context=".WebviewHomeActivity">

    <TextView
        android:id="@+id/hometext"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:layout_marginBottom="100dp"
        android:text="Video is locked by Ads, Please watch full ads to unlock the video"
        android:textAlignment="center"
        android:textColor="#FF9800"
        android:textSize="24sp"

        ></TextView>

    <Button
        android:id="@+id/homewebviewbtn1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/hometext"
        android:background="@drawable/custom_button_bg"
        android:text="Korean"
        android:layout_centerInParent="true"
        />

    <Button
        android:id="@+id/homewebviewbtn2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/homewebviewbtn1"
        android:background="@drawable/custom_button_bg"
        android:text="Chinese"
        android:layout_centerInParent="true"
        />
    <Button
        android:id="@+id/homewebviewbtn3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/homewebviewbtn2"
        android:background="@drawable/custom_button_bg"
        android:text="Japanese"
        android:layout_centerInParent="true"
        />

    <Button
        android:id="@+id/homewebviewbtn4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/homewebviewbtn3"
        android:background="@drawable/custom_button_bg"
        android:text="Thai"
        android:layout_centerInParent="true"
        />

    <Button
        android:id="@+id/homewebviewbtn5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/homewebviewbtn4"
        android:background="@drawable/custom_button_bg"
        android:text="Indian"
        android:layout_centerInParent="true"
        />

    <Button
        android:id="@+id/homewebviewbtn6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/homewebviewbtn5"
        android:background="@drawable/custom_button_bg"
        android:text="Indonesian"
        android:layout_centerInParent="true"
        />
    <Button
        android:id="@+id/homewebviewbtn7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/homewebviewbtn6"
        android:background="@drawable/custom_button_bg"
        android:text="Russian"
        android:layout_centerInParent="true"
        />
    <Button
        android:id="@+id/homewebviewbtn8"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/homewebviewbtn7"
        android:background="@drawable/custom_button_bg"
        android:text="American"
        android:layout_centerInParent="true"
        />

    <Button
        android:id="@+id/homewebviewbtn9"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/homewebviewbtn8"
        android:background="@drawable/custom_button_bg"
        android:text="Arbabian"
        android:layout_centerInParent="true"
        />

    <Button
        android:id="@+id/homewebviewbtn10"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/homewebviewbtn9"
        android:background="@drawable/custom_button_bg"
        android:text="Turkish"
        android:layout_centerInParent="true"
        />


</LinearLayout>

Java Layout with 10 Rewarded unit

package com.example.facefoftvfacefof;

import static android.content.ContentValues.TAG;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import android.widget.VideoView;

import com.google.android.gms.ads.AdError;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.FullScreenContentCallback;
import com.google.android.gms.ads.LoadAdError;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.OnUserEarnedRewardListener;
import com.google.android.gms.ads.initialization.InitializationStatus;
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
import com.google.android.gms.ads.rewarded.RewardItem;
import com.google.android.gms.ads.rewarded.RewardedAd;
import com.google.android.gms.ads.rewarded.RewardedAdLoadCallback;

public class WebviewHomeActivity extends AppCompatActivity {



    Button homewebviewbtn1,homewebviewbtn2,homewebviewbtn3,homewebviewbtn4,homewebviewbtn5,homewebviewbtn6;
    Button homewebviewbtn7,homewebviewbtn8,homewebviewbtn9,homewebviewbtn10;

    private RewardedAd rewardedAd1;
    private RewardedAd rewardedAd2;
    private RewardedAd rewardedAd3;
    private RewardedAd rewardedAd4;
    private RewardedAd rewardedAd5;
    private RewardedAd rewardedAd6;
    private RewardedAd rewardedAd7;
    private RewardedAd rewardedAd8;
    private RewardedAd rewardedAd9;
    private RewardedAd rewardedAd10;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_webview_home);

        MobileAds.initialize(this, new OnInitializationCompleteListener() {
            @Override
            public void onInitializationComplete(InitializationStatus initializationStatus) {
            }
        });

        homewebviewbtn1 = findViewById(R.id.homewebviewbtn1);
        homewebviewbtn2 = findViewById(R.id.homewebviewbtn2);
        homewebviewbtn3 = findViewById(R.id.homewebviewbtn3);
        homewebviewbtn4 = findViewById(R.id.homewebviewbtn4);
        homewebviewbtn5 = findViewById(R.id.homewebviewbtn5);
        homewebviewbtn6 = findViewById(R.id.homewebviewbtn6);
        homewebviewbtn7 = findViewById(R.id.homewebviewbtn7);
        homewebviewbtn8 = findViewById(R.id.homewebviewbtn8);
        homewebviewbtn9 = findViewById(R.id.homewebviewbtn9);
        homewebviewbtn10 = findViewById(R.id.homewebviewbtn10);

        //Button 1 with reawrded ads

        LoadRewardedAd1();



        homewebviewbtn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (rewardedAd1 != null) {
                    Activity activityContext = WebviewHomeActivity.this;
                    rewardedAd1.show(activityContext, new OnUserEarnedRewardListener() {
                        @Override
                        public void onUserEarnedReward(@NonNull RewardItem rewardItem) {
                            // Handle the reward.
                        }
                    });

                    rewardedAd1.setFullScreenContentCallback(new FullScreenContentCallback() {
                        @Override
                        public void onAdClicked() {
                            // Called when a click is recorded for an ad.
                        }

                        @Override
                        public void onAdDismissedFullScreenContent() {
                            // Called when ad is dismissed.
                            // Set the ad reference to null so you don't show the ad a second time.
                            startActivity(new Intent(WebviewHomeActivity.this, webviewActivity.class));
                            LoadRewardedAd1();

                        }

                        @Override
                        public void onAdFailedToShowFullScreenContent(AdError adError) {
                            // Called when ad fails to show.

                            rewardedAd1 = null;
                            startActivity(new Intent(WebviewHomeActivity.this, webviewActivity.class));

                        }

                        @Override
                        public void onAdImpression() {
                            // Called when an impression is recorded for an ad.

                        }

                        @Override
                        public void onAdShowedFullScreenContent() {
                            // Called when ad is shown.

                        }
                    });


                } else {
                    startActivity(new Intent(WebviewHomeActivity.this, webviewActivity.class));
                }

            }
        });

        //Button second with reawrded ads

        LoadRewardedAd2();

        homewebviewbtn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (rewardedAd2 != null) {
                    Activity activityContext = WebviewHomeActivity.this;
                    rewardedAd2.show(activityContext, new OnUserEarnedRewardListener() {
                        @Override
                        public void onUserEarnedReward(@NonNull RewardItem rewardItem) {
                            // Handle the reward.
                        }
                    });

                    rewardedAd2.setFullScreenContentCallback(new FullScreenContentCallback() {
                        @Override
                        public void onAdClicked() {
                            // Called when a click is recorded for an ad.
                        }

                        @Override
                        public void onAdDismissedFullScreenContent() {
                            // Called when ad is dismissed.
                            // Set the ad reference to null so you don't show the ad a second time.
                            startActivity(new Intent(WebviewHomeActivity.this, Webview2Activity.class));
                            LoadRewardedAd2();

                        }

                        @Override
                        public void onAdFailedToShowFullScreenContent(AdError adError) {
                            // Called when ad fails to show.

                            rewardedAd2 = null;
                            startActivity(new Intent(WebviewHomeActivity.this, Webview2Activity.class));

                        }

                        @Override
                        public void onAdImpression() {
                            // Called when an impression is recorded for an ad.

                        }

                        @Override
                        public void onAdShowedFullScreenContent() {
                            // Called when ad is shown.

                        }
                    });


                } else {
                    startActivity(new Intent(WebviewHomeActivity.this, Webview2Activity.class));
                }

            }

        });

        //Button 3 with reawrded ads


        LoadRewardedAd3();
        homewebviewbtn3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (rewardedAd3 != null) {
                    Activity activityContext = WebviewHomeActivity.this;
                    rewardedAd3.show(activityContext, new OnUserEarnedRewardListener() {
                        @Override
                        public void onUserEarnedReward(@NonNull RewardItem rewardItem) {
                            // Handle the reward.
                        }
                    });

                    rewardedAd3.setFullScreenContentCallback(new FullScreenContentCallback() {
                        @Override
                        public void onAdClicked() {
                            // Called when a click is recorded for an ad.
                        }

                        @Override
                        public void onAdDismissedFullScreenContent() {
                            // Called when ad is dismissed.
                            // Set the ad reference to null so you don't show the ad a second time.
                            startActivity(new Intent(WebviewHomeActivity.this, Webview3Activity.class));
                            LoadRewardedAd3();

                        }

                        @Override
                        public void onAdFailedToShowFullScreenContent(AdError adError) {
                            // Called when ad fails to show.

                            rewardedAd3 = null;
                            startActivity(new Intent(WebviewHomeActivity.this, Webview3Activity.class));

                        }

                        @Override
                        public void onAdImpression() {
                            // Called when an impression is recorded for an ad.

                        }

                        @Override
                        public void onAdShowedFullScreenContent() {
                            // Called when ad is shown.

                        }
                    });


                } else {
                    startActivity(new Intent(WebviewHomeActivity.this, Webview3Activity.class));
                }

            }
        });


        LoadRewardedAd4();
        homewebviewbtn4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (rewardedAd4 != null) {
                    Activity activityContext = WebviewHomeActivity.this;
                    rewardedAd4.show(activityContext, new OnUserEarnedRewardListener() {
                        @Override
                        public void onUserEarnedReward(@NonNull RewardItem rewardItem) {
                            // Handle the reward.
                        }
                    });

                    rewardedAd4.setFullScreenContentCallback(new FullScreenContentCallback() {
                        @Override
                        public void onAdClicked() {
                            // Called when a click is recorded for an ad.
                        }

                        @Override
                        public void onAdDismissedFullScreenContent() {
                            // Called when ad is dismissed.
                            // Set the ad reference to null so you don't show the ad a second time.
                            startActivity(new Intent(WebviewHomeActivity.this, Webview4Activity.class));
                            LoadRewardedAd4();

                        }

                        @Override
                        public void onAdFailedToShowFullScreenContent(AdError adError) {
                            // Called when ad fails to show.

                            rewardedAd4 = null;
                            startActivity(new Intent(WebviewHomeActivity.this, Webview4Activity.class));

                        }

                        @Override
                        public void onAdImpression() {
                            // Called when an impression is recorded for an ad.

                        }

                        @Override
                        public void onAdShowedFullScreenContent() {
                            // Called when ad is shown.

                        }
                    });


                } else {
                    startActivity(new Intent(WebviewHomeActivity.this, Webview4Activity.class));
                }




            }
        });

        LoadRewardedAd5();
        homewebviewbtn5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (rewardedAd5 != null) {
                    Activity activityContext = WebviewHomeActivity.this;
                    rewardedAd5.show(activityContext, new OnUserEarnedRewardListener() {
                        @Override
                        public void onUserEarnedReward(@NonNull RewardItem rewardItem) {
                            // Handle the reward.
                        }
                    });

                    rewardedAd5.setFullScreenContentCallback(new FullScreenContentCallback() {
                        @Override
                        public void onAdClicked() {
                            // Called when a click is recorded for an ad.
                        }

                        @Override
                        public void onAdDismissedFullScreenContent() {
                            // Called when ad is dismissed.
                            // Set the ad reference to null so you don't show the ad a second time.
                            startActivity(new Intent(WebviewHomeActivity.this, Webview5Activity.class));
                            LoadRewardedAd5();

                        }

                        @Override
                        public void onAdFailedToShowFullScreenContent(AdError adError) {
                            // Called when ad fails to show.

                            rewardedAd5 = null;
                            startActivity(new Intent(WebviewHomeActivity.this, Webview5Activity.class));

                        }

                        @Override
                        public void onAdImpression() {
                            // Called when an impression is recorded for an ad.

                        }

                        @Override
                        public void onAdShowedFullScreenContent() {
                            // Called when ad is shown.

                        }
                    });


                } else {
                    startActivity(new Intent(WebviewHomeActivity.this, Webview5Activity.class));
                }




            }
        });


        LoadRewardedAd6();
        homewebviewbtn6.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (rewardedAd6 != null) {
                    Activity activityContext = WebviewHomeActivity.this;
                    rewardedAd6.show(activityContext, new OnUserEarnedRewardListener() {
                        @Override
                        public void onUserEarnedReward(@NonNull RewardItem rewardItem) {
                            // Handle the reward.
                        }
                    });

                    rewardedAd6.setFullScreenContentCallback(new FullScreenContentCallback() {
                        @Override
                        public void onAdClicked() {
                            // Called when a click is recorded for an ad.
                        }

                        @Override
                        public void onAdDismissedFullScreenContent() {
                            // Called when ad is dismissed.
                            // Set the ad reference to null so you don't show the ad a second time.
                            startActivity(new Intent(WebviewHomeActivity.this, Webview6Activity.class));
                            LoadRewardedAd6();

                        }

                        @Override
                        public void onAdFailedToShowFullScreenContent(AdError adError) {
                            // Called when ad fails to show.

                            rewardedAd6 = null;
                            startActivity(new Intent(WebviewHomeActivity.this, Webview6Activity.class));

                        }

                        @Override
                        public void onAdImpression() {
                            // Called when an impression is recorded for an ad.

                        }

                        @Override
                        public void onAdShowedFullScreenContent() {
                            // Called when ad is shown.

                        }
                    });


                } else {
                    startActivity(new Intent(WebviewHomeActivity.this, Webview6Activity.class));
                }




            }
        });



        LoadRewardedAd7();
        homewebviewbtn7.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (rewardedAd7 != null) {
                    Activity activityContext = WebviewHomeActivity.this;
                    rewardedAd7.show(activityContext, new OnUserEarnedRewardListener() {
                        @Override
                        public void onUserEarnedReward(@NonNull RewardItem rewardItem) {
                            // Handle the reward.
                        }
                    });

                    rewardedAd7.setFullScreenContentCallback(new FullScreenContentCallback() {
                        @Override
                        public void onAdClicked() {
                            // Called when a click is recorded for an ad.
                        }

                        @Override
                        public void onAdDismissedFullScreenContent() {
                            // Called when ad is dismissed.
                            // Set the ad reference to null so you don't show the ad a second time.
                            startActivity(new Intent(WebviewHomeActivity.this, Webview7Activity.class));
                            LoadRewardedAd7();

                        }

                        @Override
                        public void onAdFailedToShowFullScreenContent(AdError adError) {
                            // Called when ad fails to show.

                            rewardedAd7 = null;
                            startActivity(new Intent(WebviewHomeActivity.this, Webview7Activity.class));

                        }

                        @Override
                        public void onAdImpression() {
                            // Called when an impression is recorded for an ad.

                        }

                        @Override
                        public void onAdShowedFullScreenContent() {
                            // Called when ad is shown.

                        }
                    });


                } else {
                    startActivity(new Intent(WebviewHomeActivity.this, Webview7Activity.class));
                }




            }
        });


        LoadRewardedAd8();
        homewebviewbtn8.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (rewardedAd8 != null) {
                    Activity activityContext = WebviewHomeActivity.this;
                    rewardedAd8.show(activityContext, new OnUserEarnedRewardListener() {
                        @Override
                        public void onUserEarnedReward(@NonNull RewardItem rewardItem) {
                            // Handle the reward.
                        }
                    });

                    rewardedAd8.setFullScreenContentCallback(new FullScreenContentCallback() {
                        @Override
                        public void onAdClicked() {
                            // Called when a click is recorded for an ad.
                        }

                        @Override
                        public void onAdDismissedFullScreenContent() {
                            // Called when ad is dismissed.
                            // Set the ad reference to null so you don't show the ad a second time.
                            startActivity(new Intent(WebviewHomeActivity.this, Webview8Activity.class));
                            LoadRewardedAd8();

                        }

                        @Override
                        public void onAdFailedToShowFullScreenContent(AdError adError) {
                            // Called when ad fails to show.

                            rewardedAd8 = null;
                            startActivity(new Intent(WebviewHomeActivity.this, Webview8Activity.class));

                        }

                        @Override
                        public void onAdImpression() {
                            // Called when an impression is recorded for an ad.

                        }

                        @Override
                        public void onAdShowedFullScreenContent() {
                            // Called when ad is shown.

                        }
                    });


                } else {
                    startActivity(new Intent(WebviewHomeActivity.this, Webview8Activity.class));
                }




            }
        });


        LoadRewardedAd9();
        homewebviewbtn9.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (rewardedAd9 != null) {
                    Activity activityContext = WebviewHomeActivity.this;
                    rewardedAd9.show(activityContext, new OnUserEarnedRewardListener() {
                        @Override
                        public void onUserEarnedReward(@NonNull RewardItem rewardItem) {
                            // Handle the reward.
                        }
                    });

                    rewardedAd9.setFullScreenContentCallback(new FullScreenContentCallback() {
                        @Override
                        public void onAdClicked() {
                            // Called when a click is recorded for an ad.
                        }

                        @Override
                        public void onAdDismissedFullScreenContent() {
                            // Called when ad is dismissed.
                            // Set the ad reference to null so you don't show the ad a second time.
                            startActivity(new Intent(WebviewHomeActivity.this, Webview9Activity.class));
                            LoadRewardedAd9();

                        }

                        @Override
                        public void onAdFailedToShowFullScreenContent(AdError adError) {
                            // Called when ad fails to show.

                            rewardedAd9 = null;
                            startActivity(new Intent(WebviewHomeActivity.this, Webview9Activity.class));

                        }

                        @Override
                        public void onAdImpression() {
                            // Called when an impression is recorded for an ad.

                        }

                        @Override
                        public void onAdShowedFullScreenContent() {
                            // Called when ad is shown.

                        }
                    });


                } else {
                    startActivity(new Intent(WebviewHomeActivity.this, Webview9Activity.class));
                }




            }
        });




        LoadRewardedAd10();
        homewebviewbtn10.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (rewardedAd10 != null) {
                    Activity activityContext = WebviewHomeActivity.this;
                    rewardedAd10.show(activityContext, new OnUserEarnedRewardListener() {
                        @Override
                        public void onUserEarnedReward(@NonNull RewardItem rewardItem) {
                            // Handle the reward.
                        }
                    });

                    rewardedAd10.setFullScreenContentCallback(new FullScreenContentCallback() {
                        @Override
                        public void onAdClicked() {
                            // Called when a click is recorded for an ad.
                        }

                        @Override
                        public void onAdDismissedFullScreenContent() {
                            // Called when ad is dismissed.
                            // Set the ad reference to null so you don't show the ad a second time.
                            startActivity(new Intent(WebviewHomeActivity.this, Webview10Activity.class));
                            LoadRewardedAd10();

                        }

                        @Override
                        public void onAdFailedToShowFullScreenContent(AdError adError) {
                            // Called when ad fails to show.

                            rewardedAd10 = null;
                            startActivity(new Intent(WebviewHomeActivity.this, Webview10Activity.class));

                        }

                        @Override
                        public void onAdImpression() {
                            // Called when an impression is recorded for an ad.

                        }

                        @Override
                        public void onAdShowedFullScreenContent() {
                            // Called when ad is shown.

                        }
                    });


                } else {
                    startActivity(new Intent(WebviewHomeActivity.this, Webview10Activity.class));
                }




            }
        });




    }

    //LoadRewardedAd1

    public void LoadRewardedAd1(){
        AdRequest adRequest1 = new AdRequest.Builder().build();
        RewardedAd.load(this, getString(R.string.rewarded_ad_unit_id1),
                adRequest1, new RewardedAdLoadCallback() {
                    @Override
                    public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
                        // Handle the error.
                        rewardedAd1 = null;
                    }

                    @Override
                    public void onAdLoaded(@NonNull RewardedAd ad) {
                        rewardedAd1 = ad;

                    }
                });

    }

    //LoadRewardedAd2

    public void LoadRewardedAd2(){

        AdRequest adRequest2 = new AdRequest.Builder().build();
        RewardedAd.load(this, getString(R.string.rewarded_ad_unit_id2),
                adRequest2, new RewardedAdLoadCallback() {
                    @Override
                    public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
                        // Handle the error.
                        Log.d(TAG, loadAdError.toString());
                        rewardedAd2 = null;
                    }

                    @Override
                    public void onAdLoaded(@NonNull RewardedAd ad) {
                        rewardedAd2 = ad;
                        Log.d(TAG, "Ad was loaded.");

                    }
                });


    }

    //LoadRewardedAd3

    public void LoadRewardedAd3() {

        AdRequest adRequest3 = new AdRequest.Builder().build();
        RewardedAd.load(this, getString(R.string.rewarded_ad_unit_id3),
                adRequest3, new RewardedAdLoadCallback() {
                    @Override
                    public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
                        // Handle the error.
                        Log.d(TAG, loadAdError.toString());
                        rewardedAd3 = null;
                    }

                    @Override
                    public void onAdLoaded(@NonNull RewardedAd ad) {
                        rewardedAd3 = ad;
                        Log.d(TAG, "Ad was loaded.");

                    }
                });
    }

    public void LoadRewardedAd4() {

        AdRequest adRequest4 = new AdRequest.Builder().build();
        RewardedAd.load(this, getString(R.string.rewarded_ad_unit_id4),
                adRequest4, new RewardedAdLoadCallback() {
                    @Override
                    public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
                        // Handle the error.
                        Log.d(TAG, loadAdError.toString());
                        rewardedAd4 = null;
                    }

                    @Override
                    public void onAdLoaded(@NonNull RewardedAd ad) {
                        rewardedAd4 = ad;
                        Log.d(TAG, "Ad was loaded.");

                    }
                });
    }

    public void LoadRewardedAd5() {

        AdRequest adRequest5 = new AdRequest.Builder().build();
        RewardedAd.load(this, getString(R.string.rewarded_ad_unit_id5),
                adRequest5, new RewardedAdLoadCallback() {
                    @Override
                    public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
                        // Handle the error.
                        Log.d(TAG, loadAdError.toString());
                        rewardedAd5 = null;
                    }

                    @Override
                    public void onAdLoaded(@NonNull RewardedAd ad) {
                        rewardedAd5 = ad;
                        Log.d(TAG, "Ad was loaded.");

                    }
                });
    }


    public void LoadRewardedAd6() {

        AdRequest adRequest6 = new AdRequest.Builder().build();
        RewardedAd.load(this, getString(R.string.rewarded_ad_unit_id6),
                adRequest6, new RewardedAdLoadCallback() {
                    @Override
                    public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
                        // Handle the error.
                        Log.d(TAG, loadAdError.toString());
                        rewardedAd6 = null;
                    }

                    @Override
                    public void onAdLoaded(@NonNull RewardedAd ad) {
                        rewardedAd6 = ad;
                        Log.d(TAG, "Ad was loaded.");

                    }
                });
    }



    public void LoadRewardedAd7() {

        AdRequest adRequest7 = new AdRequest.Builder().build();
        RewardedAd.load(this, getString(R.string.rewarded_ad_unit_id7),
                adRequest7, new RewardedAdLoadCallback() {
                    @Override
                    public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
                        // Handle the error.
                        Log.d(TAG, loadAdError.toString());
                        rewardedAd7 = null;
                    }

                    @Override
                    public void onAdLoaded(@NonNull RewardedAd ad) {
                        rewardedAd7 = ad;
                        Log.d(TAG, "Ad was loaded.");

                    }
                });
    }



    public void LoadRewardedAd8() {

        AdRequest adRequest8 = new AdRequest.Builder().build();
        RewardedAd.load(this, getString(R.string.rewarded_ad_unit_id8),
                adRequest8, new RewardedAdLoadCallback() {
                    @Override
                    public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
                        // Handle the error.
                        Log.d(TAG, loadAdError.toString());
                        rewardedAd8 = null;
                    }

                    @Override
                    public void onAdLoaded(@NonNull RewardedAd ad) {
                        rewardedAd8 = ad;
                        Log.d(TAG, "Ad was loaded.");

                    }
                });
    }



    public void LoadRewardedAd9() {

        AdRequest adRequest9 = new AdRequest.Builder().build();
        RewardedAd.load(this, getString(R.string.rewarded_ad_unit_id9),
                adRequest9, new RewardedAdLoadCallback() {
                    @Override
                    public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
                        // Handle the error.
                        Log.d(TAG, loadAdError.toString());
                        rewardedAd9 = null;
                    }

                    @Override
                    public void onAdLoaded(@NonNull RewardedAd ad) {
                        rewardedAd9 = ad;
                        Log.d(TAG, "Ad was loaded.");

                    }
                });
    }


    public void LoadRewardedAd10() {

        AdRequest adRequest10 = new AdRequest.Builder().build();
        RewardedAd.load(this, getString(R.string.rewarded_ad_unit_id10),
                adRequest10, new RewardedAdLoadCallback() {
                    @Override
                    public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
                        // Handle the error.
                        Log.d(TAG, loadAdError.toString());
                        rewardedAd10 = null;
                    }

                    @Override
                    public void onAdLoaded(@NonNull RewardedAd ad) {
                        rewardedAd10 = ad;
                        Log.d(TAG, "Ad was loaded.");

                    }
                });
    }




}

Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="com.google.android.gms.permission.AD_ID" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.Navigation"
        tools:targetApi="31">
        <activity
            android:name=".Webview10Activity"
            android:configChanges="orientation|screenSize"
            android:exported="true" />
        <activity
            android:name=".Webview9Activity"
            android:configChanges="orientation|screenSize"
            android:exported="true" />
        <activity
            android:name=".Webview8Activity"
            android:configChanges="orientation|screenSize"
            android:exported="true" />
        <activity
            android:name=".Webview7Activity"
            android:configChanges="orientation|screenSize"
            android:exported="true" />
        <activity
            android:name=".Webview6Activity"
            android:configChanges="orientation|screenSize"
            android:exported="true" />
        <activity
            android:name=".Webview5Activity"
            android:configChanges="orientation|screenSize"
            android:exported="true" />
        <activity
            android:name=".Webview4Activity"
            android:configChanges="orientation|screenSize"
            android:exported="true" />
        <activity
            android:name=".Webview3Activity"
            android:configChanges="orientation|screenSize"
            android:exported="true" />
        <activity
            android:name=".Webview2Activity"
            android:configChanges="orientation|screenSize"
            android:exported="true" />
        <activity
            android:name=".webviewActivity"
            android:configChanges="orientation|screenSize"
            android:exported="true" />
        <activity
            android:name=".WebviewHomeActivity"
            android:exported="true" />
        <activity
            android:name=".MainActivity"
            android:configChanges="orientation|screenSize"
            android:exported="true" />
        <activity
            android:name=".WelcomeActivity"
            android:exported="true" />
        <activity
            android:name=".SplashActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <service android:name=".notif.MyFirebaseMessagingService"
            android:exported="true">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <action android:name=".MainActivity"/>
            </intent-filter>

        </service>

        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="@string/app_id" />
    </application>

</manifest>

Create a xml files in drawble custom_button_bg

<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="@color/black">


    <item>
        <shape android:shape="rectangle">
            <solid android:color="#FF9800" />
            <stroke android:color="#FF1100"
                android:width="0.8dp"/>

            <corners android:topRightRadius="8dp"
                android:bottomLeftRadius="8dp"
                />

            <size android:width="200dp"
                android:height="20dp"/>

            <gradient
                android:startColor="#FFEB3B"
                android:centerColor="#FFC107"
                android:endColor="#FF9800"/>


        </shape>


    </item>

</ripple>