Convert Your Website into a Professional Android App Using ANDROID STUDIO 2023[Free in Hindi]
Convert website into Professional Android App
Today we know. How to convert your website into a professional Android app using Android Studio? We implement many features in our app.
Table of Contents
Convert website to Android app for free
We create our app in Android Studio freely. I am available in the source code of this app.
You can publish your app in the Google Play store. And earn money by Ad Mob. See all the steps completely and get your app. If you’re facing any errors, please comment. Below is the post.
Source Code: How to Convert Website into a Professional Android App
Step 01 – How to Download Android Studio
- Open Browser
- Search Android Studio on Google
- Go to the official Website
- Download Software
- Install Software
Step 02 – How to Create Project in Android Studio
- Open “Search bar” in pc
- Type “Android”
- Click on the first Software
- Click on “Create Project” in Android Studio
- Set your app Name.
- Set your own “Package Name”
- Set your “Project Location”
- Select Language.
- Select Minimum SDK Version.
- Click on “Finish”
Step 03 – How to Open JAVA and XML Files in Android Studio
- Activity Main JAVA
- Main Activity XML
- Manifest
Step 04 – How to Remove Action Bar in Android App – Android Studio
- To remove the Action bar > go to theme > Replace “DAYNIGHT” with “No”
Step 05 – How to set or add the logo in android app in Android Studio
- Add app Logo > res > new > Image assist > select logo > resize > remove Bg > finish
Step 05 – How to add internet permissions in Android Studio – android Studio.
Internet Connection Error in android Studio
- Copy Code > Go to “AndroidManifest.xml ” > find “manifest” > Paste Code
<uses-permissionandroid:name=”android.permission.INTERNET”/>
- Copy Code > Go to “AndroidManifest.xml ” > find “manifest” > Paste Code
<uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE”/>
Step 06 – How to add webView (XML) in Android App – Android Studio
Activity Main XML
- Copy Code > Go to “Activity_Main.xml” > Remove “TextView” > Paste Code
<WebViewandroid:layout_width=”fill_parent”android:layout_height=”fill_parent”android:id=”@+id/webView”android:layout_alignParentTop=”true”android:layout_alignParentLeft=”true”android:layout_alignParentStart=”true”android:layout_alignParentBottom=”true”android:layout_alignParentRight=”true”android:layout_alignParentEnd=”true”tools:ignore=”MissingConstraints”/>
Step 07 -How to add webView (Java) in Android App – Android Studio
Main Activity JAVA
- Copy Code > Go to “Main Activity Java” > Prevent Package name or remove all code > Paste Code
- Insert Your Website URL in the highlighted text (red).
import
android.os.Bundle;import
android.webkit.WebView;import
android.webkit.WebViewClient;import
androidx.appcompat.app.AppCompatActivity;public class
MainActivityextends
AppCompatActivity {
StringwebsiteURL
=”https://myb21.com/”;// Add your website urlprivate
WebViewwebview;@Overrideprotected voidonCreate
(Bundle savedInstanceState) {super
.onCreate(savedInstanceState);
setContentView(R.layout.activity_main
);//Webview stuffwebview
= findViewById(R.id.webView
);webview
.getSettings().setJavaScriptEnabled(true
);webview
.getSettings().setDomStorageEnabled(true
);webview
.setOverScrollMode(WebView.OVER_SCROLL_NEVER
);webview
.loadUrl(websiteURL
);webview
.setWebViewClient(new
WebViewClientDemo());
}private class
WebViewClientDemoextends
WebViewClient {@Override//Keep webview in app when clicking linkspublic booleanshouldOverrideUrlLoading
(WebView view,
String url) {
view.loadUrl(url);return true;}
}}
Step 08 -How to solve internet connection error in android app – Android Studio
MainActivity.java With Internet connection Code
Copy Code > Go to “Main Activity Java” > Prevent Package name or remove all code > Paste CodeInsert Your Website URL on highlight text (red).import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebView;
import android.webkit.WebViewClient;import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity { String websiteURL = “https://myb21.com/”; // add your website url
private WebView webview;@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);if( ! CheckNetwork.isInternetAvailable(this)) //returns true if internet available
{
//if there is no internet do this
setContentView(R.layout.activity_main);
//Toast.makeText(this,”No Internet Connection, Chris”,Toast.LENGTH_LONG).show();new AlertDialog.Builder(this) //alert the person knowing they are about to close
.setTitle(“No internet connection available”)
.setMessage(“Please Check you’re Mobile data or Wifi network.”)
.setPositiveButton(“Ok”, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
})
//.setNegativeButton(“No”, null)
.show();}
else
{
//Webview stuff
webview = findViewById(R.id.webView);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setDomStorageEnabled(true);
webview.setOverScrollMode(WebView.OVER_SCROLL_NEVER);
webview.loadUrl(websiteURL);
webview.setWebViewClient(new WebViewClientDemo());}
}private class WebViewClientDemo extends WebViewClient {
@Override
//Keep webview in app when clicking links
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}}class CheckNetwork {private static final String TAG = CheckNetwork.class.getSimpleName();public static boolean isInternetAvailable(Context context)
{
NetworkInfo info = (NetworkInfo) ((ConnectivityManager)
context.getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();if (info == null)
{
Log.d(TAG,”no internet connection”);
return false;
}
else
{
if(info.isConnected())
{
Log.d(TAG,” internet connection available…”);
return true;
}
else
{
Log.d(TAG,” internet connection”);
return true;
} }
}
}
Step 09 How to set Back & Exit Feature In Android App – Android Studio
- Copy Code > Go to “Main Activity Java” > private class (web view client demo) > Paste Code
//set back button functionality@Overridepublic voidonBackPressed
() {//if user presses the back button do thisif
(webview
.isFocused() &&webview
.canGoBack()) {//check if in webview and the user can go backwebview
.goBack();//go back in webview
}else
{//do this if the webview cannot go back any furthernew
AlertDialog.Builder(this
)//alert the person knowing they are about to close
.setTitle(“EXIT”
)
.setMessage(“Are you sure. You want to close this app?”)
.setPositiveButton(“Yes”, newDialogInterface.OnClickListener() {@Overridepublic voidonClick
(DialogInterface dialog, int
which) {
finish();}
})
.setNegativeButton(“No”, null)
.show();}
}
Step 10 – How to add Swipe Down to Refresh In Android App (XML File) – Android Studio
- Copy Code > Go to “Activity Main XML” > > Paste Code (Replace with Webview)
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:id=”@+id/swipeContainer” android:layout_width=”match_parent” android:layout_height=”match_parent”> <WebView android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:id=”@+id/webView” android:layout_alignParentTop=”true” android:layout_alignParentLeft=”true” android:layout_alignParentStart=”true” android:layout_alignParentBottom=”true” android:layout_alignParentRight=”true” android:layout_alignParentEnd=”true” tools:ignore=”MissingConstraints” /></androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
Step 11 – How to add Swipe Down to Refresh In Android App (Java File) – Android Studio
Code 01
- Copy Code > Go to “Main Activity Java” > Go to the web link below the surface ( below Private web view) > Paste Code
SwipeRefreshLayout mySwipeRefreshLayout;
Code 02
- Copy Code > Go to “Main Activity Java” > web view stuff – (onCreate) > Paste Code
//Swipe to refresh functionalitymySwipeRefreshLayout
= (SwipeRefreshLayout)this
.findViewById(R.id.swipeContainer
);mySwipeRefreshLayout
.setOnRefreshListener(new
SwipeRefreshLayout.OnRefreshListener() {@Overridepublic voidonRefresh
() {webview
.reload();
}
}
);
Step 12 – How to add Swipe Down to Refresh In Android App (Java File) – Android Studio
- Copy Code > Go to “Main Activity Java” > go to private class webview client demo > Paste Code
private class
WebViewClientDemoextends
WebViewClient {@Override//Keep webview in app when clicking linkspublic booleanshouldOverrideUrlLoading
(WebView view,
String url) {
view.loadUrl(url);return true;}@Overridepublic voidonPageFinished
(WebView view,
String url) {super
.onPageFinished(view,
url);mySwipeRefreshLayout
.setRefreshing(false
);
}
}
Step 13 How to Convert Website into Professional Android App Using ANDROID STUDIO 2023 [HINDI] -Complete Java file Code
package
com.myb21.p04cpdfdownload;import
android.app.AlertDialog;import
android.content.Context;import
android.content.DialogInterface;import
android.net.ConnectivityManager;import
android.net.NetworkInfo;import
android.os.Bundle;import
android.util.Log;import
android.webkit.WebView;import
android.webkit.WebViewClient;import
androidx.appcompat.app.AppCompatActivity;import
androidx.swiperefreshlayout.widget.SwipeRefreshLayout;public class
MainActivityextends
AppCompatActivity {
StringwebsiteURL
=”https://magazinex.in/”;//
sets web urlprivate
WebViewwebview;
SwipeRefreshLayoutmySwipeRefreshLayout;@Overrideprotected voidonCreate
(Bundle savedInstanceState) {super
.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);if
( ! CheckNetwork.isInternetAvailable(this))//returns true if internet available
{//if there is no internet do this setContentView(R.layout.activity_main);//Toast.makeText(this,”No Internet Connection, Chris”,Toast.LENGTH_LONG).show();new
AlertDialog.Builder(this)//alert the person knowing they are about to close.setTitle(“No internet connection available”)
.setMessage(“Please Check you’re Mobile data or Wifi network.”)
.setPositiveButton(“Ok”, new DialogInterface.OnClickListener() {@Overridepublic voidonClick(DialogInterface dialog, intwhich) {finish();
}
})//.setNegativeButton(“No”, null).show();}else{//Webview stuffwebview= findViewById(R.id.webView);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setDomStorageEnabled(true);
webview.setOverScrollMode(WebView.OVER_SCROLL_NEVER);
webview.loadUrl(websiteURL);
webview.setWebViewClient(new
WebViewClientDemo());
}//Swipe to refresh functionalitymySwipeRefreshLayout
= (SwipeRefreshLayout)this.findViewById(R.id.swipeContainer);mySwipeRefreshLayout
.setOnRefreshListener(new
SwipeRefreshLayout.OnRefreshListener() {@Overridepublic voidonRefresh
() {webview.reload();
}
}
);}private class
WebViewClientDemoextends
WebViewClient {@Override//Keep webview in app when clicking linkspublic booleanshouldOverrideUrlLoading
(WebView view,String url) {view.loadUrl(url);return true;
}@Overridepublic voidonPageFinished
(WebView view, String url) {super.onPageFinished(view,url);
mySwipeRefreshLayout.setRefreshing(false);
}
}//set back button functionality@Overridepublic voidonBackPressed() {//if user presses the back button do thisif
(webview.isFocused() &&
webview.canGoBack()) {//check if in webview and the user can go backwebview
.goBack();//
go back in webview}else
{//do this if the webview cannot go back any furthernew
AlertDialog.Builder(this
)//alert the person knowing they are about to close
.setTitle(“EXIT”
)
.setMessage(“Are you sure. You want to close this app?”)
.setPositiveButton(“Yes”, newDialogInterface.OnClickListener() {@Overridepublic voidonClick
(DialogInterface dialog, int
which) {
finish();}
})
.setNegativeButton(“No”, null)
.show();}
}}class
CheckNetwork {private static final
StringTAG
= CheckNetwork.class
.getSimpleName();public static booleanisInternetAvailable
(Context context)
{
NetworkInfo info = (NetworkInfo) ((ConnectivityManager)
context.getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();if
(info ==null
)
{
Log.d(TAG,”no internet connection”);return false;
}else
{if (info.isConnected())
{
Log.d(TAG,” internet connection available…”);return true;
}else
{
Log.d(TAG,” internet connection”);return true;
}
}
}
}
Code 13
Screen Rotation:
- add in manifest
android:screenOrientation=”portrait”>
FAQ
- Convert Website to Android App for free
- Convert the Website into an App for free
- Convert Website into App free
- Convert Website into Android App
- Convert Website to Android App source code GitHub
- Convert Website to Android App with push notifications
- Convert Website to APK free
- Create an APK file for your Website free
- Download an APK file to your PC.
betturkey
• 27/07/2024betturkey
Anonymous
• 21/04/2024Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
najlepszy sklep
• 16/04/2024Wow, superb weblog layout! How lengthy have you ever been blogging for?
you make running a blog look easy. The full glance of your site is
wonderful, as well as the content material! You can see similar here
dobry sklep
Alene
• 20/02/2024Hello There. I discovered your weblog using msn. This is an extremely well written article.
I’ll be sure to bookmark it and come back to read more of your useful info.
Thanks for the post. I will definitely return.
Natilee
• 20/02/2024If some one wishes expert view on the topic of blogging then i suggest him/her to go to see this weblog, Keep up the nice job.
Ashtin
• 20/02/2024Hi! This post couldn’t be written any better! Reading through this post reminds me of my old room mate!
He always kept talking about this. I will forward this write-up to him.
Fairly certain he will have a good read. Thank you
for sharing!
Deshawn
• 18/02/2024Terrific article! This is the type of information that are supposed to be shared across the net.
Disgrace on Google for now not positioning this put up
upper! Come on over and consult with my site . Thanks =)
Business Classifieds
Meraki
Pools Now
Advanced Electrolysis Melbourne
Minsky McCormick & Hallagan P.C.
Vast Construction
OmegaRender
Croma Digital
HINDUSTAN CATERERS PEN
S. V. DEO & ASSOCIATES PEN
Solar Power Company in Vadodara
Emerson Kirra
Himalayan Pure Shilajit Resin 25gm – Indus Organics
UKY ROYAL NETWORK SOLUTION PVT. LTD.
SANJIVANI HOSPITAL
USA Berkey Filters
Kore Agro International
Il Forno Bocconcini Bar & Restaurant
AlmaMate Info Tech | Salesforce Training
Web design Mississauga – CS Web Solutions
Aloha: First 100% Certified Natural Latex Mattress in India
Eternal Smiles Dental Centre
China Fox Group Pty Ltd
BURHANI TRADERS PEN RAIGAD
Edge Bathrooms
Taj Exotica Resort & Spa, Goa
TIRUPATI MAGIC PEN
ASHVA EDUCATION OF PARAMEDICAL SCIENCE PEN
Sadou Design
AAROGYA DENTAL CLINIC
Trade Mark Registration India
Somee Enterprises
Van Den Heuvel Law Office
SRUSHTI AQUA SYSTEM PEN
AMAY OPTICS
OBEROI HOTEL
AMBIKA ENTERPRISES PEN
CLIMATIZER’S ENGINEERINGS PEN
Shree Samartha Clinical Lab Pen
SLA Consultants India
DIGITAL MARKETING
Oasis Neon Signs USA
Shree Construction Co. Pen
Peninsula Grand Hotel
All Chemical Manufacturing & Consultancy
Asian Heart Institute
Norwest Podiatry
Renew Car Care, Inc.
MAGIC TOUCH SPA AND MAKEOVER PEN
Digital Signature Certificate
SHREE FURNISHING PEN RAIGAD