[android-developers] Re: No callback when list item is touched.

2009-02-01 Thread Brendon Drew
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.

 list.setOnItemSelectedListener(new
AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView? arg0, View arg1,
int position, long id) {
Log.v(this.toString(), Item Selected);
viewItem(id);
}

public void onNothingSelected(AdapterView? arg0) {
// TODO Auto-generated method stub
Log.v(this.toString(), Nothing Selected);



On Sun, Feb 1, 2009 at 2:12 PM, Mark Murphy mmur...@commonsware.com wrote:


 Brendon wrote:
  I have a ListView that is populated with a custom adapter.  When an
  item is clicked with the trackball, it works fine, i.e. I can catch
  the event and move on, though when I touch an item with my finger
  there is no callback from the listener.  The item does respond to the
  touch, by turning orange for that moment.
 
  Here is how I've setup the listener.  This is within an Activity, not
  a ListActivity.
 
 list.setOnItemClickListener(new
  AdapterView.OnItemClickListener() {
 
public void
 onItemClick(AdapterView? arg0, View arg1,
int position, long
 id) {
viewItem(id);
 
}
 });
 
  What am I missing? Is there another listener I need to configure?

 You need to call setOnItemSelectedListener() to handle taps like that.

 --
 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
-~--~~~~--~~--~--~---



[android-developers] Re: No callback when list item is touched.

2009-02-01 Thread Brendon Drew
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(Contexthttp://code.google.com/android/reference/android/content/Context.htmlcontext,
int resource, int textViewResourceId,
List http://code.google.com/android/reference/java/util/List.htmlT
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=#FF
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=#FF
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
-~--~~~~--~~--~--~---



[android-developers] Re: No callback when list item is touched.

2009-02-01 Thread Brendon Drew
the button had neither focusable or clickable defined. and why was I getting
the event when clicking with the trackball, but not when touching it.

On Feb 1, 2009 5:04 PM, Romain Guy romain...@google.com wrote:

When an item contains a focusable/clickable item you cannot get the
onitemclick event.

  On Feb 1, 2009 4:41 PM, Brendon Drew b.j.d...@gmail.com wrote:  
No, I am printing a log ...

On Sun, Feb 1, 2009 at 2:41 PM, Mark Murphy mmur...@commonsware.com wrote:
   Brendon Drew wro...
Brendon

--~--~-~--~~~---~--~~ You received this
message because you are su...

--~--~-~--~~~---~--~~ You received this
message because you are s...

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: No callback when list item is touched.

2009-02-01 Thread Brendon Drew
ahh, right, I misunderstood.  I thought you meant if those were set to true.


but still, why does it work with the trackball?

  On Feb 1, 2009 5:04 PM, Romain Guy romain...@google.com wrote:  
When an item contains a ...

On Feb 1, 2009 4:41 PM, Brendon Drew b.j.d...@gmail.com wrote:
  No, I am printing ...

  On Sun, Feb 1, 2009 at 2:41 PM, Mark Murphy mmur...@commonsware.com
wrote:Brendon Dr...

  --~--~-~--~~~---~--~~ You received this
message because you are...

--~--~-~--~~~---~--~~ You received this
message because you are s

--~--~-~--~~~---~--~~ You received this
message because you are subs...

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Orientation sensor gone bad?

2008-11-08 Thread Brendon Drew


Maybe download the Bubble app from the market, see if its really the sensor 
as opposed to a bug in your code.

Sent from my gPhone

On Nov 7, 2008 12:20 PM, kelly [EMAIL PROTECTED] wrote:


Hello,

Has anyone noticed trouble with the orientation sensor in their phone?
Mine was returning values as described in the Android documentation
until about 12am last night. Up till then, holding the device in a
vertical orientation, the pitch value was -90 degrees, upside down was
+90 degrees, and so on. Since that time, the sensor doesn't seem to be
working correctly. Now it reads -20 in an upright position and 20 in
an upside-down position. Is there a way to reset the phone (or at
least the orientation sensors) so it works correctly again? I have
several applications now that don't work right because of this.

Thanks,
Kelly



--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Does /proc/meminfo show the correct memory info?

2008-11-07 Thread Brendon Drew
So how do I get the total amount of RAM on the system?

On Fri, Nov 7, 2008 at 2:19 PM, hackbod [EMAIL PROTECTED] wrote:


 This is the amount of RAM available to the kernel and higher-level
 system as regular memory.  The rest is used for various other things
 like the radio image, frame buffers and surfaces, etc.

 On Nov 7, 8:45 am, Brendon [EMAIL PROTECTED] wrote:
  I'm working on a System Monitor app (first version is already in the
  market)  to get my feet wet with Android.  When getting RAM totals, I
  grab MemTotal from /proc/meminfo, however this only shows 99129KB.
  Doesn't the G1 have 192MB of RAM?  Is there another field from this
  file I should add to this total, or is this just not the right way to
  figure it out.  I think I remember reading that some changes were made
  to the kernel to handle memory more efficiently, could this have an
  impact?
 
  On any other Linux system I've used, meminfo shows the correct total
  for system RAM, so could we have been shorted on the G1?
 



-- 

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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Does /proc/meminfo show the correct memory info?

2008-11-07 Thread Brendon Drew
Well, it's not available to the user directly, but it is used by the system
as a whole.  I'm simply curious how to determine total physical RAM.

On Fri, Nov 7, 2008 at 6:04 PM, Eric [EMAIL PROTECTED] wrote:


  So how do I get the total amount of RAM on the system?

 From the published specifications for the phone.

 What's the point of knowing how much memory *isn't* available for use?

 



-- 

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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---