Thursday, November 14, 2013

Apss


So you got a website? Great! If you are looking to convert it into an Android application, you have come to the right place. Since you are new to Android development, (I assume you are and that’s why you are here) I will try to be specific about every single thing. So let’s get started.
You need to set up the IDE and Android SDK to develop apps for Android. If you already have everything set up, move on. If not, follow this tutorial first.
Converting a website into Android application:
It’s very simple and straight forward. We will be making a simple app that displays a website using WebView. Let’s get going.
Open up ecipse and go to File >> New >> Other. Choose Android Application Project from the list.
app project
Write down Application, project and package name for your app. Package name should be a unique identifier.
Minimum required SDK should be set to API 8. It means that a user must be running Android 2.2 (froyo) or higher to run your app .Set the target sdk and compile with to 4.3.
app project

Click Next, then next again and choose the icon image for your app. Click next to proceed. Choose Blank Activity from the list and click next. Change Layout Name to ‘main’
blank activity
Click finish. Eclipse will now generate some folders and files for your project and you will be taken to main.xml layout.
This is the graphical layout where you see an Android frame displaying Hello world! Click main.xml beside Graphical Layout. Remove TextView and initiazlie new WebView link this:

Now your main.xml should look like this:

Now go to src >> your_package_name >> MainActivity.java. Change all the content (except your package name at the top) with the following code:

Last step is to add Internet permission in AndroidManifest.xml file.

permission
Now initialize Android emulator from virtual device manager to test your app. To do so, open Android Virtual Device Manager from Eclipse.
avd
Click New. Fill out the fields as shown below and click ok to create your new android emulator.
emulator
That’s it. Now right click on your package and choose Run As >> Android Application. You should now see your app running on android emulator.