Hi,
Im stuck trying to get hold of the event for the outer TextView in a
ListActivity. This is the code I have:
In Manifest I start the ListActivity:
...
<activity android:name="AppList" android:label="@string/app">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
This won't fire in the code, probably since this is a ListActivity:
...
period.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
TimesheetUtil.showListDialog(v.getContext(), months);
}
});
...
Below won't help me, since my header TextView is not in the List
itself:
@Override
protected void onListItemClick(ListView l, View v, int position,
long id) {
super.onListItemClick(l, v, position, id);
editTimesheet(id);
}
My GUI have the following layout:
Header
...
List1
List2
...
Footer
In the Header I have a TextView where I want trigger a Dialog (see XML
below <TextView android:id="@+id/period"),
it works when this is an Activity, but not in this ListActivity.
My XML for my ListActivity with Header and Footer:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/period"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="Period: "/
>
<-----------------------------------------------------------
<TextView android:id="@+id/month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/period"/>
<TextView android:id="@+id/project_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"/>
<TextView android:id="@+id/project"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/project_name"
android:layout_alignTop="@+id/project_name"
android:text="Project: "/>
<ListView android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:paddingBottom="20dp"/>
<TextView android:id="@+id/android:empty"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:textSize="20sp"
android:text="No data!"/>
<TextView android:id="@+id/total_hours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Total: "/>
<TextView android:id="@+id/hours_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/total_hours"/>
<TextView android:id="@+id/month_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"/>
<TextView android:id="@+id/total_month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/month_amount"
android:layout_alignTop="@+id/month_amount"
android:text="Amount: "/
>
</RelativeLayout>
Any help most appreciated,
Regards Jonas.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---