Brendon,
  could you please comment out the button in your XML and run it again?

Cheers,
Mariano

On Sun, Feb 1, 2009 at 10:40 PM, Brendon Drew <b.j.d...@gmail.com> wrote:

> No, I am printing a log entry just before I call viewItem(), and I wasn't
> seeing that log statement when touching the item.
>
> Though I think I have found the problem. I narrowed it down to my custom
> adapter that extends ArrayAdapter.  In my adapter I call the overloaded
> ArrayAdapter constructor:
> public 
> ArrayAdapter(Context<http://code.google.com/android/reference/android/content/Context.html>context,
>  int resource, int textViewResourceId,
> List <http://code.google.com/android/reference/java/util/List.html><T>
> objects) I use this so I can define a standalone XML layout (resource) to
> use for each item in the list. Then when overriding getView(), I call
> super.getView() to get that layout, set the elements based on the object at
> that position, then return the layout for that row.
>
> The problem occurs when my layout contains a Button or ButtonView element.
> After taking out the Button (which I wanted for a speficic action to be
> taken), the listener is now getting a callback when touching the item.
>
> Is this a bug or am I not doing something correctly?
>
> Below is an XML layout for my rows.  Simply commenting out the Button
> element fixed the problem.
>
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout
>     xmlns:android="http://schemas.android.com/apk/res/android";
>     android:layout_height="60px"
>     android:orientation="horizontal"
>     android:id="@+id/row_id"
>     android:layout_width="fill_parent">
>     <ImageView android:id="@+id/row_icon"
>         android:layout_height="wrap_content"
>         android:layout_width="wrap_content"
>         android:layout_gravity="center_vertical"/>
>     <LinearLayout android:layout_height="60px"
>         android:orientation="vertical"
>         android:id="@+id/row_text"
>         android:layout_width="wrap_content"
>         android:layout_weight="1">
>
>
>     <TextView android:id="@+id/test_row_text"
>                 android:layout_height="wrap_content"
>                 android:textColor="#FFFFFF"
>                 android:textSize="14px"
>                 android:layout_weight="1"
>                 android:layout_width="wrap_content"/>
>     <TextView android:id="@+id/test_row_desc"
>                 android:layout_height="wrap_content"
>                 android:textColor="#FFFFFF"
>                 android:textSize="14px"
>                 android:layout_weight="1"
>                 android:layout_width="wrap_content"/>
>     <Button android:id="@+id/test_row_action_button"
>         android:text="@string/add"
>         android:layout_width="wrap_content"
>         android:layout_height="wrap_content"
>         android:layout_gravity="center_vertical"/>
>     </LinearLayout>
>
> On Sun, Feb 1, 2009 at 2:41 PM, Mark Murphy <mmur...@commonsware.com>wrote:
>
>>
>> Brendon Drew wrote:
>> > I do have that listener defined as well. Though again, I'm not getting a
>> > callback when I touch it.  I do get a call back when selecting an item
>> > with the trackball.
>>
>> Besides, on further reflection, I had them backwards, anyway.
>> Trackball/D-pad movement is "select", tap is "click".
>>
>> Without more code, I can't give you a solid answer. What you're doing
>> sure looks good.
>>
>> Are you sure the issue isn't something inside of viewItem() -- that
>> you're getting the event but viewItem() isn't responding to it properly
>> in the click case?
>>
>> --
>> Mark Murphy (a Commons Guy)
>> http://commonsware.com
>> _The Busy Coder's Guide to Android Development_ Version 2.0 Published!
>>
>>
>>
>
>
> --
>
> Brendon
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to