Posted by: kahgoh on: 10 December, 2008
In Building a Menu for your Android (V1.0 R1) App, a menu was created for an application. The context menu can create menus based on the current view that has focus.
In order to create context menus, the application needs to know which views will have a menu. This is done by calling registerForContextMenu with the [...]
Posted by: kahgoh on: 25 November, 2008
In Building a simple menu in Android, a menu was built using the MenuBuilder. Since the release of version 1.0 (release 1), MenuBuilder has been removed. In this tutorial, we’ll set up a custom menu that gets displayed when the menu button is pressed.
To add the menu for your application, your activity needs to override [...]
Posted by: kahgoh on: 13 September, 2008
Creating a custom view is as simple as inheriting from the View class and overriding the methods that need to be overridden. In this example, a custom button is implemented in this way. The button shall feature a labelled image (i.e. an image with text underneath).
[...]
Posted by: kahgoh on: 5 August, 2008
The menu builder class provides a way to build a simple menu, similar to the one below, in Android.
Posted by: kahgoh on: 1 July, 2008
In a previous post, I showed how to add listeners to buttons so that you can modify its text when its in focus or it has been clicked. The listener can be easily modified to show an alert dialog. You can use a ready-built dialog by using the AlertDialog.Builder class. The simplest way creating a [...]
Posted by: kahgoh on: 29 June, 2008
Code has been updated on 19 Aug 2008 to work with 0.9 beta
Lets say you have an Android (if you don’t know what Android is, have a look at the Android website) view with two buttons, like this view:
1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:orientation="vertical"
4 android:layout_width="fill_parent"
5 android:layout_height="fill_parent"
6 android:id="@+id/backgroundView">
7 <Button android:id="@+id/testButton"
8 android:text="@string/buttonText"
9 android:layout_width="wrap_content"
10 android:layout_height="wrap_content" />
11 <Button android:id="@+id/fakeButton"
12 android:layout_width="wrap_content"
13 android:layout_height="wrap_content"
14 android:text="Fake" />
15 </LinearLayout>
Like in Swing, to [...]