July 09, 2015

Professional Android WebView Application With Splash Screen and Share Button.


In this Tutorial I will teach you how to make Professional looking Android WebView Application.

Part I


Part II



Features:

Having Splash Screen
Loading Animation before Website Loads into App
Share Button on The Action Bar.

Requirements:

Windows or Mac Computer With
Android Studio & JDK 7 Installed
No need of Knowledge of Coding
Little Brain. 

NOTE: In this guide i will be asking you to copy and paste code into your file. That indicates you first remove complete code particular file and paste my code.

Steps :

Open Android Studio and Select File=>New Project.

Follow Screens.....


Set Application Name and package name what ever you want.


Select Target SDK as per your Needs



Don't change these details

Now Navigate to MainActivity.java and double click on it.



Now Copy and Paste below Code into MainActivity.java file. Replace my project name with your's in 1st line of code. In Line No 27 replace "http://karthiktechfreak.blogspot.in/" with your url. Don't use www. prfix. paste in same same format you are looking. Next Change custom share data in red color with lines you want to sown share message in line numbers 71 & 72  and give your website url  in line 27th Line
Now Right Click on your Project name udnder java folder and select create New Class and Name it Splash and copy and paste below code into Splash.java file. Replace my project name with your's in 1st line of code
Now Create one more java class file like above and name it as MyAppWebViewClient now copy and paste below code into MyAppWebViewClient.java file. And give your website url without any www or http prefixes as i gave there in line number 15 Replace my project name with your's in 1st line of code

Now we are done with Java Files. If android studio shows any errors ignore them. All errors will be gone by the end of this tutorial.

Now Copy Below Code into activity_main.xml

Now We Will Create new layout under folder layouts. For that Right Click on Layout and select new Xml File as shown in below figure. Name Layout as activity_splash.


Now Copy and Paste Below Code into activity_splash.xml




Now open menu_main.xml in menu folder and paste below code into it.

Now Open AndroidManifest.xml file From manifests folder and copy below code into it. replace project name with your project name in the 3rd line


Now Finally Open Values Folder and place below code in strings.xml and change app_name string value to yours in line number two.
By this we had finished all coding Part.

Now open computer and navigate to your Project folder YourProjectName\app\src\main\res, there will be four folders with name mipmap change ic_launcher.png with your icon but don't change name and only png format are supported. And place an image file with name vert_loading.png in all folders. vert_loading.png will be your Startup screen.

At last our Project structure looks like below image...


Now go to buil in top menu of Android Studio and select Generate signed Apk and epxort your Application. After Succesfull export copy it to your phone and install. Or Upload to play store.

Watch how to Generate Signed Apk in Android Studio.