Android Webkit Tutorial

Recently, I've been playing with the Android SDK. The main thing that has me pumped about Android is the fact that it's open and the fact that I can actually write code for it without having to get a Mac and run Mac OS X. I've been messing around with it a couple weeks, and I found that there wasn't a good set of code samples for developing with Android.

So, here's a rough description of what you need to do to get a WebView to actually be useful in Android. First of all, you should already be familiar with the basics, since we're not going to be spending too much time on them here. You need to use the following in the layout:

            < WebView android:id="@+id/appView"
            android:layout_width="fill_parent" />

This should be in a layout element in your XML Layout. I use the Linear Layout similar to the tutorial, but you may want to use a different layout. Then, I started using it with the following Java code:

WebView appView;
appView = (WebView) findViewById(;

This code should be put in the onCreate method of the activity, since this will be loaded at the beginning of the activity. This is the most basic way to make sure that you get a full running browser. It's something that I didn't find straight forward from the API docs, so I figured that I'd pass this thing on. It'll be a while since I'll be getting one of these phones, since I'm in Canada, but I have a feeling that this will be coming up again very soon.