Saturday, 16 June 2012

Placing Controls in a Widget in Android and Listening to the events from them.


Now in today’s tutorial I am going to show how to place controls like buttons inside the widget and listen to their events and respond to it.


I am proceeding the same as the previous tutorials.
First I will create a new project named “ControlsInWidget” and name the activity “MyActivity.java”.
Now we will create a layout for this main activity. settings.xml
These are the contents of settings.xml
?
1
2
3
4
5
6
7
8
9
10
11
12
13
<TableLayout android:id="@+id/TableLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
<TextView android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/tv1"
    android:text="CoderzHeaven Widget Settings Activity"
    android:textColor="@android:color/white"
    android:textSize="15dip"
    android:textStyle="bold"
    android:layout_marginTop="5dip"/>
</TableLayout>

Read the complete post from here.

No comments:

Post a Comment