how to convert website into Android app in android studio (source code)

in this article below show the source code website is convert to android application by using android studio. copy code and paste code with respective file android studio.



Manifest.xml                 



<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

(paste this code above or bellow application )

MainActivity.java          

package com.gotektips;
/** develop by shubham vairale on 15-12-2017**/
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdRequest.Builder;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.InterstitialAd;

public class MainActivity extends ActionBarActivity {
    private InterstitialAd interstitial;
    InterstitialAd mInterstitialAd;
    private WebView myWebView;
    ProgressDialog pDialog;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#123456")));
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowHomeEnabled(true);
        this.myWebView = (WebView) findViewById(R.id.webView);
        this.myWebView.getSettings().setJavaScriptEnabled(true);
        this.myWebView.loadUrl("http://www.gotektips.com");
        this.myWebView.setWebViewClient(new WebViewClient());
        AdView mAdView = (AdView) findViewById(R.id.adView);
        AdRequest adRequest = new Builder().build();
        mAdView.loadAd(adRequest);
        this.interstitial = new InterstitialAd(this);
        this.interstitial.setAdUnitId(getString(R.string.admob_interstitial_id));
        this.interstitial.loadAd(adRequest);
        this.interstitial.setAdListener(new AdListener() {
            public void onAdLoaded() {
                MainActivity.this.displayInterstitial();
            }
        });
    }

    public void onBackPressed() {
        if (this.myWebView.canGoBack()) {
            this.myWebView.goBack();
        } else {
            ShowAlert();
        }
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            Intent whatsappIntent = new Intent("android.intent.action.SEND");
            whatsappIntent.setType("text/plain");
            whatsappIntent.putExtra("android.intent.extra.TEXT", ("about your app, etc .\n\nhttps://play.google.com/store/apps/details?id=" + getPackageName() + "\n").toString());
            try {
                startActivity(Intent.createChooser(whatsappIntent, "Share using"));
            } catch (ActivityNotFoundException e) {
                Toast.makeText(getApplicationContext(), "No app have not been installed.", 20).show();
            }
            return true;
        }
        if (id == 16908332) {
            ShowAlert();
        }
        return super.onOptionsItemSelected(item);
    }

    public void displayInterstitial() {
        if (this.interstitial.isLoaded()) {
            this.interstitial.show();
        }
    }

    void ShowAlert() {
        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
        alertDialogBuilder.setTitle(getString(R.string.app_name));
        alertDialogBuilder.setIcon(R.mipmap.ic_launcher);
        alertDialogBuilder.setMessage("If you Enjoy Using this App ,then please take a moment to Share it . Thanks for your support !").setCancelable(false).setPositiveButton(" Rate Us ", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                try {
                    MainActivity.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("market://details?id=" + MainActivity.this.getPackageName())));
                } catch (ActivityNotFoundException e) {
                    MainActivity.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("http://play.google.com/store/apps/details?id=" + MainActivity.this.getPackageName())));
                }
            }
        }).setNeutralButton("Exit", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                MainActivity.this.finish();
            }
        }).setNegativeButton("No, thanks ", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                dialog.cancel();
            }
        });
        alertDialogBuilder.create().show();
    }
}
(replace http://www.gotektips.com your website URL)

res/layout/activity_main.xml     
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    xmlns:ads="http://schemas.android.com/apk/res-auto">
    <WebView android:id="@+id/webView"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_alignParentLeft="true"        android:layout_alignParentTop="true"        android:layout_alignParentRight="true" />
    <com.google.android.gms.ads.AdView        android:id="@+id/adView"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_alignParentLeft="true"        ads:adSize="SMART_BANNER"        ads:adUnitId="@string/banner_ad_unit_id"        android:layout_alignParentBottom="true"        android:layout_alignParentRight="true"        android:layout_alignParentEnd="true"        />
</RelativeLayout>

res/ menu/menu_main.xml         

<?xml version="1.0" encoding="utf-8"?><menu xmlns:android="http://schemas.android.com/apk/res-auto"    xmlns:app="http://schemas.android.com/apk/res/android">
    <item app:id="@+id/action_settings" app:orderInCategory="100" app:title="Share App"  />
</menu>

res/values/colors.xml

<?xml version="1.0" encoding="utf-8"?><resources>
    <color name="colorPrimary">#3F51B5</color>
    <color name="colorPrimaryDark">#303F9F</color>
    <color name="colorAccent">#FF4081</color>
</resources>

res/values/strings.xml                 

<resources>
    <string name="app_name">Gotektips</string>
    <string name="banner_ad_unit_id">#</string>
    <string name="admob_interstitial_id">#</string>
    <string name="App_id">#</string>
</resources>



(Replace # with respective id)

res/values/styles.xml                  
<resources>
<!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
</resources>

Gradle Scripts/build.gradle (Module:app)   

compile 'com.hannesdorfmann.smoothprogressbar:library:1.0.0'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-vector-drawable:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.google.firebase:firebase-ads:10.0.1'

(paste this code in above testCompile 'junit:junit:4.12'  instruction )