How to Make Android Webview in Eclipse

Welcome guys, we back again into androidmypride.blogspot.com. Are you still being interested my post about how to make project android apps with eclipse?. In this time and this sepcial occasion i would like to give you a trick how to make android webview in eclipse.
Before entering this topic, do you know what is android webview?. Android webview is the application in android system application that will appears a site where you want to put a the address site without opening a browser in your smartphone's android. This application will give you simple ways to open a site what do you want.
Prepare your elipse and make a new project as usuall you do. if you don't know about that, you can go to my last post about how make a new project with eclipse. Oke, check this out guys, i will try to give you step by step make android webview in eclipse:
1. I hope all of you have undetstood about make a new project
2. After making new project, main_activity.xml must you make as bellow :

main_activity.xml in eclipse

3.Now, you will see code in java, don't be afraid hehe.. you must open in   src > MainActivity.java and make code like bellow:
MainActivity.java

package com.example.berita123;

import android.os.Bundle;
import android.view.Window;
import android.webkit.WebView;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.DialogInterface;
import android.webkit.WebViewClient;
import android.view.MenuItem;
 
@SuppressLint("SetJavaScriptEnabled")
public class MainActivity extends Activity {
 
 private WebView mWebView;
 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        //this.requestWindowFeature(Window.FEATURE_PROGRESS);
        setContentView(R.layout.activity_main);
        mWebView = (WebView) findViewById(R.id.webView);
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.setWebViewClient(new MamaJahatWebViewClient());
        mWebView.loadUrl("http://www.anndroidmypride.blogspot.com/");
    }
 
    private class MamaJahatWebViewClient extends WebViewClient{
     @Override
     public boolean shouldOverrideUrlLoading(WebView webview, String url){
      webview.loadUrl(url);
      return true;
     }
    }
}


5. If you have finished to make that code, now the last you must go to AndroidMainfest.xml and add code bellow:

AndroidMainfest.xml

<uses-permission android:name="android.permission.INTERNET">
Put code like this!!!!


AndroidManifest in android

6. Finish! run now in your smartphone

Oke guys, i hope this tutorial about how to make android webview in eclipse was enough. Many activity else you can do in eclipse. Still waiting my next post, and i promise to give you some interesting toturial android apps in eclipse..see you

1 Response to "How to Make Android Webview in Eclipse"

  1. Ensure you have Eclipse IDE for Java Developers installed and set up for Android development. How Unblock Invites Open Eclipse, go to "File" > "New" > "Android Application Project."

    ReplyDelete