Ads Top

How To Create A Simple Web Browsing App For Android?

How To Create A Simple Web Browsing App For Android?
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).


New Project


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"

/>
Code


Step 3: Edit AndroidManifest.xml


Open �AndroidManifest.xml� and add the following code, after manifest tag:


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


Code




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.


Finished App


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.

No comments:

Categories

adsense adsense optimization adsense tips Animation Announcement Apps Background backlinks Basic blog Blog Design blogger Blogger Design Blogger Hack blogger pages blogger posts Blogger Security Blogger Special Tricks Blogger Templates Blogger Tips Blogger Tips & Tricks Blogger tools blogger tricks Blogger Widgets Blogger Widgets and plugins Blogging Basic Tips Blogging ethics Blogging tips Blogging Tools Blogging Tricks Btemplates 2013 Btemplates 2014 Bugs and Errors click bombing Comments css CSS and HTMLTricks CSS3 Cursors custom domain Design Drop Down Menu Earning Tips Editing emoticons Events Facebook Facebook tricks Featured Content Slider firebug Flash Free Coupons Free Recharge Gadget Generator Google Google AdSense Google Analytics Google Plus Google Plus Tricks Guest Posts Horizontal Menu How To HowTo Tuts HTML Image Image Effects Increase traffic instagram Interesting invalid clicks Java Script javascript jQuery Label labels Link Building Links LOGO Makers Make Money Make Money Online Marketing Menu bar menus Menus for Blogger Multi Tabbed Navigation navigation menu News Numbered Page Optimizing Other Tricks Page Photoshop Pop Out popular posts Post posts presentations Pure CSS Menu recent comments recent posts related posts Responsive Blogger Templates robots Rss Search box SEO SEO Strategy SEO Tips & Tricks sitemap Slide Show slideshows Social Media social media plugins statcounter static pages Style your Blog swf Tab Menu Template Template Designing Template Tricks Templates templates 2016 threaded comments Tips tools Traffic Tips Twitter Unlock modems Vertical bar Video Wallpapers Web Designing web hosting Webmaster Tools Widget Widget Generators Widgets wordpress WordPress Plugins WordPress Themes WordPress Tricks WP Tips
Powered by Blogger.