
Did
you know that you can create a basic web browsing android app for your
website with just a few lines of code? Web browsing Android apps are
great if you have a nice website and you want to make your brand’s
application with just a minimal amount of code. At the same time, it is a
great way to learn more about Android application development,
and it doesn't require a background in application development. So, in
this tutorial, I will teach you how to create a basic web browsing app
of your own!
Before moving on with this tutorial
you should know, how to set up the SDK and must have understanding of
creating a basic Android app. Here's what we've covered so far on the
subject. Just bear with this tutorial, and if you have difficulty
understanding a concept, then you can go back to any one of these
previous tutorials.
Alright, let’s move on with the tutorial!
Creating a web browsing App for Android
Step 1: Create a new Android Application project
Using Eclipse create a new
Android application project (“WebBrowsingApp”). For this tutorial I have
selected API 16 (Jelly Bean).

Step 2: Edit activity_main.xml
Open “activity_main.xml” and add the following code:
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>

Step 3: Edit AndroidManifest.xml
Open “AndroidManifest.xml” and add the following code, after manifest tag:
<uses-permission android:name="android.permission.INTERNET" />

Basically we’ve provided internet access to our application.
Step 4: Edit MainActivity.java
Finally edit “MainActivity.java”. Copy the following libraries:
import android.os.Bundle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.view.Menu;
import android.webkit.WebView;
import android.webkit.WebViewClient;
Now, overwrite the “public boolean onCreateOptionsMenu(Menu menu)” function with:
@SuppressLint("SetJavaScriptEnabled") @Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.setWebViewClient(new WebViewClient());
myWebView.loadUrl("http://www.mybloggertricks.com");
return true;
}
Your MainActivity.java class should look like this;

Step 5: Execute
Now, it’s time to run our newly
created web browsing app. Right click Project, and select Run
as->Android application. It should look something like this.

Pretty simple, right? You can add more
functionality, and deliver your content in a much more optimized
fashion to make your app much more mobile user-friendly.
0 Comments
Good day precious one, We love you more than anything.