[android-developers] Re: ListView not responding to Click or KeyPress

2010-03-21 Thread pentium10
Is there any solution on this problem? I ran into the same, and
looking for ways to get this done.

On Feb 4, 5:05 pm, chboing chbo...@gmail.com wrote:
 i have the exact same problem ...

 i have an Activity that contains a Listview which is used in a Dialog
 My ListView contains only TextViews. It's initialized in my own
 baseAdapter. Built from a txt file on the sd card.
 it's working nicely except the main goal for me, select one of those
 item in the ListView :(

 and same as Ted, in debugger mode, nothing happen when i click one
 item, it doesnt go into the onItemClick method

 anyone got an idea ? i lost some hours already on this ...

 did you find anything new about this Ted ?

 On 6 jan, 02:15, Ted ted.eker...@gmail.com wrote:



  Hey!
  I think I have the same problem, and I donothave any focusable
  children. My layout for a Row in the ListView contains:

  LinearLayout
     |
     +-- ImageView
     |
     +-- LinearLayout
             |
             +-- TextView
             |
             +-- TextView
             |
             +-- TextView

  and the Main activity is like this:

  code
  public class Main extends Activity
  {
          ArrayListNode nodes;

      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState)
      {
          requestWindowFeature(Window.FEATURE_NO_TITLE);
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);

          ArrayListNode nodes = new ArrayListNode();
          nodes.add(new Node(My name, My text, 13:10, 0));

          NodeRowAdapter nra = new NodeRowAdapter(this, nodes);

          ListView listView1 = (ListView) findViewById
  (R.id.ListViewNodes);
          listView1.setOnItemClickListener(newOnItemClickListener() {

                  public void onItemClick(AdapterView? parent,Viewview, int
  position, long id)
                  {
                          System.out.println (get onItem Click position=
  +position);
              }
                  });
          listView1.setAdapter(nra);
      }}

  /code

  It seems to me as nothing at all happens when I click the item in the
  ListView...

  On 4 Dec 2009, 19:43, Romain Guy romain...@android.com wrote:

   This is unnecessary. This problem will occur if your list item
   contains focusable children (like buttons, edittexts, etc.)

   On Thu, Dec 3, 2009 at 4:20 PM, hwii77 hwi...@gmail.com wrote:
maybe maybe try this: Add android:clickable=true  (and
android:focusable=true)

On Dec 2, 1:37 pm, n179911 n179...@gmail.com wrote:
Hi,

I have a simple ListView in my layout.xml file.

    ListView android:id=@+id/action_list
            android:layout_width=fill_parent
            android:layout_height=wrap_content
        /

And in my javacode, I add a setOnItemClickListener() to my listview:

listView.setOnItemClickListener(newOnItemClickListener() {

                public void onItemClick(AdapterView? parent,Viewview,
int position, long id) {
                    System.out.println (get onItem Click position=
+position);

                }
            });

But when I run on G1. I don't see any print out when I click an item 
on the
ListView on the phone.
Or when I select an item using track ball and press CENTER.

Can you please tell me why to resolve my problem?

Thanks in advance.

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

   --
   Romain Guy
   Android framework engineer
   romain...@android.com

   Note: please don't send private questions to me, as I don't have time
   to provide private support.  All such questions should be posted on
   public forums, where I and others can see and answer them

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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words REMOVE ME as the subject.


[android-developers] Re: ListView not responding to Click or KeyPress

2010-03-21 Thread Brion Emde
I'm pretty sure all these people found the answer to their problem, as
this is such a common need.

The minimum you should need to make a clickable list view is this:


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.yourlistview);
setListAdapter(new YourAdapter());
}

protected void onListItemClick() {
}

should now be called.

On Mar 21, 8:55 am, pentium10 pentiu...@gmail.com wrote:
 Is there any solution on this problem? I ran into the same, and
 looking for ways to get this done.

 On Feb 4, 5:05 pm, chboing chbo...@gmail.com wrote:



  i have the exact same problem ...

  i have an Activity that contains a Listview which is used in a Dialog
  My ListView contains only TextViews. It's initialized in my own
  baseAdapter. Built from a txt file on the sd card.
  it's working nicely except the main goal for me, select one of those
  item in the ListView :(

  and same as Ted, in debugger mode, nothing happen when i click one
  item, it doesnt go into the onItemClick method

  anyone got an idea ? i lost some hours already on this ...

  did you find anything new about this Ted ?

  On 6 jan, 02:15, Ted ted.eker...@gmail.com wrote:

   Hey!
   I think I have the same problem, and I donothave any focusable
   children. My layout for a Row in the ListView contains:

   LinearLayout
      |
      +-- ImageView
      |
      +-- LinearLayout
              |
              +-- TextView
              |
              +-- TextView
              |
              +-- TextView

   and the Main activity is like this:

   code
   public class Main extends Activity
   {
           ArrayListNode nodes;

       /** Called when the activity is first created. */
       @Override
       public void onCreate(Bundle savedInstanceState)
       {
           requestWindowFeature(Window.FEATURE_NO_TITLE);
           super.onCreate(savedInstanceState);
           setContentView(R.layout.main);

           ArrayListNode nodes = new ArrayListNode();
           nodes.add(new Node(My name, My text, 13:10, 0));

           NodeRowAdapter nra = new NodeRowAdapter(this, nodes);

           ListView listView1 = (ListView) findViewById
   (R.id.ListViewNodes);
           listView1.setOnItemClickListener(newOnItemClickListener() {

                   public void onItemClick(AdapterView? parent,Viewview, 
   int
   position, long id)
                   {
                           System.out.println (get onItem Click position=
   +position);
               }
                   });
           listView1.setAdapter(nra);
       }}

   /code

   It seems to me as nothing at all happens when I click the item in the
   ListView...

   On 4 Dec 2009, 19:43, Romain Guy romain...@android.com wrote:

This is unnecessary. This problem will occur if your list item
contains focusable children (like buttons, edittexts, etc.)

On Thu, Dec 3, 2009 at 4:20 PM, hwii77 hwi...@gmail.com wrote:
 maybe maybe try this: Add android:clickable=true  (and
 android:focusable=true)

 On Dec 2, 1:37 pm, n179911 n179...@gmail.com wrote:
 Hi,

 I have a simple ListView in my layout.xml file.

     ListView android:id=@+id/action_list
             android:layout_width=fill_parent
             android:layout_height=wrap_content
         /

 And in my javacode, I add a setOnItemClickListener() to my listview:

 listView.setOnItemClickListener(newOnItemClickListener() {

                 public void onItemClick(AdapterView? 
 parent,Viewview,
 int position, long id) {
                     System.out.println (get onItem Click position=
 +position);

                 }
             });

 But when I run on G1. I don't see any print out when I click an item 
 on the
 ListView on the phone.
 Or when I select an item using track ball and press CENTER.

 Can you please tell me why to resolve my problem?

 Thanks in advance.

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

--
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

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

[android-developers] Re: ListView not responding to Click or KeyPress

2010-03-21 Thread Brion Emde
Actually, I could be more clear.

I think that every Android beginner at least build the sample programs
that have stuff in them they are interested in. For example, the
APIDemos sample contains many example of ListViews.

If you don't want to build the APIDemos sample, most of what is there,
including many ListView-based programs (and lots of other interesting
stuff) in the Resources Tab, under Sample Programs, here:

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List1.html

The full index for the APIDemos sample in the Resources is:

http://developer.android.com/resources/samples/ApiDemos/index.html


On Mar 21, 9:55 am, pentium10 pentiu...@gmail.com wrote:
 Is there any solution on this problem? I ran into the same, and
 looking for ways to get this done.

 On Feb 4, 5:05 pm, chboing chbo...@gmail.com wrote:



  i have the exact same problem ...

  i have an Activity that contains a Listview which is used in a Dialog
  My ListView contains only TextViews. It's initialized in my own
  baseAdapter. Built from a txt file on the sd card.
  it's working nicely except the main goal for me, select one of those
  item in the ListView :(

  and same as Ted, in debugger mode, nothing happen when i click one
  item, it doesnt go into the onItemClick method

  anyone got an idea ? i lost some hours already on this ...

  did you find anything new about this Ted ?

  On 6 jan, 02:15, Ted ted.eker...@gmail.com wrote:

   Hey!
   I think I have the same problem, and I donothave any focusable
   children. My layout for a Row in the ListView contains:

   LinearLayout
      |
      +-- ImageView
      |
      +-- LinearLayout
              |
              +-- TextView
              |
              +-- TextView
              |
              +-- TextView

   and the Main activity is like this:

   code
   public class Main extends Activity
   {
           ArrayListNode nodes;

       /** Called when the activity is first created. */
       @Override
       public void onCreate(Bundle savedInstanceState)
       {
           requestWindowFeature(Window.FEATURE_NO_TITLE);
           super.onCreate(savedInstanceState);
           setContentView(R.layout.main);

           ArrayListNode nodes = new ArrayListNode();
           nodes.add(new Node(My name, My text, 13:10, 0));

           NodeRowAdapter nra = new NodeRowAdapter(this, nodes);

           ListView listView1 = (ListView) findViewById
   (R.id.ListViewNodes);
           listView1.setOnItemClickListener(newOnItemClickListener() {

                   public void onItemClick(AdapterView? parent,Viewview, 
   int
   position, long id)
                   {
                           System.out.println (get onItem Click position=
   +position);
               }
                   });
           listView1.setAdapter(nra);
       }}

   /code

   It seems to me as nothing at all happens when I click the item in the
   ListView...

   On 4 Dec 2009, 19:43, Romain Guy romain...@android.com wrote:

This is unnecessary. This problem will occur if your list item
contains focusable children (like buttons, edittexts, etc.)

On Thu, Dec 3, 2009 at 4:20 PM, hwii77 hwi...@gmail.com wrote:
 maybe maybe try this: Add android:clickable=true  (and
 android:focusable=true)

 On Dec 2, 1:37 pm, n179911 n179...@gmail.com wrote:
 Hi,

 I have a simple ListView in my layout.xml file.

     ListView android:id=@+id/action_list
             android:layout_width=fill_parent
             android:layout_height=wrap_content
         /

 And in my javacode, I add a setOnItemClickListener() to my listview:

 listView.setOnItemClickListener(newOnItemClickListener() {

                 public void onItemClick(AdapterView? 
 parent,Viewview,
 int position, long id) {
                     System.out.println (get onItem Click position=
 +position);

                 }
             });

 But when I run on G1. I don't see any print out when I click an item 
 on the
 ListView on the phone.
 Or when I select an item using track ball and press CENTER.

 Can you please tell me why to resolve my problem?

 Thanks in advance.

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

--
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

-- 
You received this message because you are 

[android-developers] Re: ListView not responding to Click or KeyPress

2010-02-04 Thread chboing
i have the exact same problem ...

i have an Activity that contains a Listview which is used in a Dialog
My ListView contains only TextViews. It's initialized in my own
baseAdapter. Built from a txt file on the sd card.
it's working nicely except the main goal for me, select one of those
item in the ListView :(

and same as Ted, in debugger mode, nothing happen when i click one
item, it doesnt go into the onItemClick method

anyone got an idea ? i lost some hours already on this ...

did you find anything new about this Ted ?



On 6 jan, 02:15, Ted ted.eker...@gmail.com wrote:
 Hey!
 I think I have the same problem, and I donothave any focusable
 children. My layout for a Row in the ListView contains:

 LinearLayout
    |
    +-- ImageView
    |
    +-- LinearLayout
            |
            +-- TextView
            |
            +-- TextView
            |
            +-- TextView

 and the Main activity is like this:

 code
 public class Main extends Activity
 {
         ArrayListNode nodes;

     /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState)
     {
         requestWindowFeature(Window.FEATURE_NO_TITLE);
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);

         ArrayListNode nodes = new ArrayListNode();
         nodes.add(new Node(My name, My text, 13:10, 0));

         NodeRowAdapter nra = new NodeRowAdapter(this, nodes);

         ListView listView1 = (ListView) findViewById
 (R.id.ListViewNodes);
         listView1.setOnItemClickListener(newOnItemClickListener() {

                 public void onItemClick(AdapterView? parent, View view, int
 position, long id)
                 {
                         System.out.println (get onItem Click position=
 +position);
             }
                 });
         listView1.setAdapter(nra);
     }}

 /code

 It seems to me as nothing at all happens when I click the item in the
 ListView...

 On 4 Dec 2009, 19:43, Romain Guy romain...@android.com wrote:



  This is unnecessary. This problem will occur if your list item
  contains focusable children (like buttons, edittexts, etc.)

  On Thu, Dec 3, 2009 at 4:20 PM, hwii77 hwi...@gmail.com wrote:
   maybe maybe try this: Add android:clickable=true  (and
   android:focusable=true)

   On Dec 2, 1:37 pm, n179911 n179...@gmail.com wrote:
   Hi,

   I have a simple ListView in my layout.xml file.

       ListView android:id=@+id/action_list
               android:layout_width=fill_parent
               android:layout_height=wrap_content
           /

   And in my javacode, I add a setOnItemClickListener() to my listview:

   listView.setOnItemClickListener(newOnItemClickListener() {

                   public void onItemClick(AdapterView? parent, View view,
   int position, long id) {
                       System.out.println (get onItem Click position=
   +position);

                   }
               });

   But when I run on G1. I don't see any print out when I click an item on 
   the
   ListView on the phone.
   Or when I select an item using track ball and press CENTER.

   Can you please tell me why to resolve my problem?

   Thanks in advance.

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

  --
  Romain Guy
  Android framework engineer
  romain...@android.com

  Note: please don't send private questions to me, as I don't have time
  to provide private support.  All such questions should be posted on
  public forums, where I and others can see and answer them

-- 
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: ListView not responding to Click or KeyPress

2010-01-26 Thread Bing Jin Lin
Hello

 I have the same problem, my ListActivity has overridden
onListItemClick method,

But I can't see click event passed into the method when I click on
item, also highlight row is not shown.

Follwing is my layout file for a row on ListView: it does not contain
any foucsable children.

?xml version=1.0 encoding=utf-8?
RelativeLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:layout_height=60dip android:layout_width=fill_parent
android:padding=3dip android:gravity=center android:id=@+id/
list_item_complex
android:clickable=true android:focusable=true
android:focusableInTouchMode=true
ImageView android:id=@+id/list_item_1image
android:layout_height=fill_parent android:src=@drawable/icon
android:layout_alignParentLeft=true 
android:layout_width=57dip
android:focusableInTouchMode=false 
android:longClickable=false
android:layout_alignWithParentIfMissing=true
android:background=@android:color/transparent
android:focusable=true android:clickable=false/ImageView
TextView android:id=@+id/list_item_text_title android:text=List
item title
android:layout_width=fill_parent
android:layout_height=wrap_content
android:textAppearance=@style/ListItemTitleText
android:gravity=left|center_vertical
android:layout_alignParentTop=true 
android:layout_toRightOf=@+id/
list_item_1image
android:layout_alignWithParentIfMissing=true
android:layout_alignParentRight=true
android:background=@android:color/transparent
android:focusableInTouchMode=false 
android:longClickable=false
android:linksClickable=false android:focusable=true
android:clickable=false/TextView
TextView android:id=@+id/list_item_summary_text
android:text=List item summary 
android:layout_width=fill_parent
android:layout_height=wrap_content 
android:textAppearance=@style/
ListItemSummaryText
android:gravity=left|center_vertical 
android:layout_below=@+id/
list_item_text_title
android:layout_toRightOf=@+id/list_item_1image
android:layout_alignParentRight=true
android:layout_alignWithParentIfMissing=true
android:background=@android:color/transparent
android:longClickable=false 
android:focusableInTouchMode=false
android:linksClickable=false android:focusable=true
android:clickable=false/TextView
TextView android:layout_height=wrap_content
android:layout_width=fill_parent android:id=@+id/
list_item_misc_text
android:text=List item misc android:textAppearance=@style/
ListItemMiscText
android:gravity=left|center_vertical 
android:layout_below=@+id/
list_item_summary_text
android:layout_alignParentBottom=true
android:layout_alignParentRight=true 
android:layout_toRightOf=@
+id/list_item_1image
android:background=@android:color/transparent
android:focusableInTouchMode=false 
android:longClickable=false
android:linksClickable=false android:focusable=true
android:clickable=false/TextView

/RelativeLayout

Sincerely yours
B.J.

On 1月6日, 上午9時15分, Ted ted.eker...@gmail.com wrote:
 Hey!
 I think I have the same problem, and I do not have any focusable
 children. My layout for a Row in theListViewcontains:

 LinearLayout
    |
    +-- ImageView
    |
    +-- LinearLayout
            |
            +-- TextView
            |
            +-- TextView
            |
            +-- TextView

 and the Main activity is like this:

 code
 public class Main extends Activity
 {
         ArrayListNode nodes;

     /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState)
     {
         requestWindowFeature(Window.FEATURE_NO_TITLE);
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);

         ArrayListNode nodes = new ArrayListNode();
         nodes.add(new Node(My name, My text, 13:10, 0));

         NodeRowAdapter nra = new NodeRowAdapter(this, nodes);

        ListViewlistView1 = (ListView) findViewById
 (R.id.ListViewNodes);
         listView1.setOnItemClickListener(new OnItemClickListener() {

                 public void onItemClick(AdapterView? parent, View view, int
 position, long id)
                 {
                         System.out.println (get onItem Click position=
 +position);
             }
                 });
         listView1.setAdapter(nra);
     }}

 /code

 It seems to me as nothing at all happens when I click the item in 
 theListView...

 On 4 Dec 2009, 19:43, Romain Guy romain...@android.com wrote:

  This is unnecessary. This problem will occur if your list item
  contains focusable children 

[android-developers] Re: ListView not responding to Click or KeyPress

2010-01-26 Thread Bing Jin Lin
I re-post layout file and ListActivity implementation

public class SimpleListActivity extends ListActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

getListView().setAdapter(new SimpleAdapter());
getListView().setClickable(true);
getListView().setFocusable(true);
getListView().setFocusableInTouchMode(true);
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
}

@Override
protected void onListItemClick(ListView l, View v, int position, long
id) {
Log.d(, onListItem event received.);
super.onListItemClick(l, v, position, id);
}

class SimpleAdapter extends BaseAdapter {
private String items[] = { item-1, item-2, item-3 };

public int getCount() {
return items.length;
}

public Object getItem(int position) {
return items[position];
}

public long getItemId(int position) {
return position;
}

public View getView(int position, View convertView, ViewGroup
parent) {
if (convertView == null) {
convertView = 
SimpleListActivity.this.getLayoutInflater()

.inflate(R.layout.list_item_complex, null);
}
return convertView;
}

@Override
public boolean areAllItemsEnabled() {
return true;
}

@Override
public int getItemViewType(int position) {
return 1;
}

@Override
public int getViewTypeCount() {
return 1;
}
}
}

===Layout file =

?xml version=1.0 encoding=utf-8?
RelativeLayout
xmlns:android=http://schemas.android.com/apk/res/android;
android:layout_height=60dip
android:layout_width=fill_parent
android:padding=3dip
android:gravity=center
android:id=@+id/list_item_complex
android:clickable=true
android:focusable=true
android:focusableInTouchMode=true

ImageView
android:id=@+id/list_item_1image
android:layout_height=fill_parent
android:src=@drawable/icon
android:layout_alignParentLeft=true
android:layout_width=57dip
android:focusableInTouchMode=false
android:longClickable=false
android:layout_alignWithParentIfMissing=true
android:background=@android:color/transparent
android:focusable=true
android:clickable=false /
TextView
android:id=@+id/list_item_text_title
android:text=List item title
android:layout_width=fill_parent
android:layout_height=wrap_content
android:textAppearance=@style/ListItemTitleText
android:gravity=left|center_vertical
android:layout_alignParentTop=true
android:layout_toRightOf=@+id/list_item_1image
android:layout_alignWithParentIfMissing=true
android:layout_alignParentRight=true
android:background=@android:color/transparent
android:focusableInTouchMode=false
android:longClickable=false
android:linksClickable=false
android:focusable=true
android:clickable=false /
TextView
android:id=@+id/list_item_summary_text
android:text=List item summary
android:layout_width=fill_parent
android:layout_height=wrap_content
android:textAppearance=@style/ListItemSummaryText
android:gravity=left|center_vertical
android:layout_below=@+id/list_item_text_title
android:layout_toRightOf=@+id/list_item_1image
android:layout_alignParentRight=true
android:layout_alignWithParentIfMissing=true
android:background=@android:color/transparent
android:longClickable=false
android:focusableInTouchMode=false
android:linksClickable=false
android:focusable=true
android:clickable=false /
TextView
android:layout_height=wrap_content
android:layout_width=fill_parent
android:id=@+id/list_item_misc_text
android:text=List item misc

[android-developers] Re: ListView not responding to Click or KeyPress

2010-01-06 Thread Ted
Hey!
I think I have the same problem, and I do not have any focusable
children. My layout for a Row in the ListView contains:

LinearLayout
   |
   +-- ImageView
   |
   +-- LinearLayout
   |
   +-- TextView
   |
   +-- TextView
   |
   +-- TextView

and the Main activity is like this:

code
public class Main extends Activity
{
ArrayListNode nodes;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

ArrayListNode nodes = new ArrayListNode();
nodes.add(new Node(My name, My text, 13:10, 0));

NodeRowAdapter nra = new NodeRowAdapter(this, nodes);

ListView listView1 = (ListView) findViewById
(R.id.ListViewNodes);
listView1.setOnItemClickListener(new OnItemClickListener() {

public void onItemClick(AdapterView? parent, View view, int
position, long id)
{
System.out.println (get onItem Click position=
+position);
}
});
listView1.setAdapter(nra);
}
}
/code

It seems to me as nothing at all happens when I click the item in the
ListView...

On 4 Dec 2009, 19:43, Romain Guy romain...@android.com wrote:
 This is unnecessary. This problem will occur if your list item
 contains focusable children (like buttons, edittexts, etc.)





 On Thu, Dec 3, 2009 at 4:20 PM, hwii77 hwi...@gmail.com wrote:
  maybe maybe try this: Add android:clickable=true  (and
  android:focusable=true)

  On Dec 2, 1:37 pm, n179911 n179...@gmail.com wrote:
  Hi,

  I have a simple ListView in my layout.xml file.

      ListView android:id=@+id/action_list
              android:layout_width=fill_parent
              android:layout_height=wrap_content
          /

  And in my javacode, I add a setOnItemClickListener() to my listview:

  listView.setOnItemClickListener(new OnItemClickListener() {

                  public void onItemClick(AdapterView? parent, View view,
  int position, long id) {
                      System.out.println (get onItem Click position=
  +position);

                  }
              });

  But when I run on G1. I don't see any print out when I click an item on the
  ListView on the phone.
  Or when I select an item using track ball and press CENTER.

  Can you please tell me why to resolve my problem?

  Thanks in advance.

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

 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  All such questions should be posted on
 public forums, where I and others can see and answer them
-- 
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: ListView not responding to Click or KeyPress

2009-12-04 Thread hwii77
maybe maybe try this: Add android:clickable=true  (and
android:focusable=true)

On Dec 2, 1:37 pm, n179911 n179...@gmail.com wrote:
 Hi,

 I have a simple ListView in my layout.xml file.

     ListView android:id=@+id/action_list
             android:layout_width=fill_parent
             android:layout_height=wrap_content
         /

 And in my javacode, I add a setOnItemClickListener() to my listview:

 listView.setOnItemClickListener(new OnItemClickListener() {

                 public void onItemClick(AdapterView? parent, View view,
 int position, long id) {
                     System.out.println (get onItem Click position=
 +position);

                 }
             });

 But when I run on G1. I don't see any print out when I click an item on the
 ListView on the phone.
 Or when I select an item using track ball and press CENTER.

 Can you please tell me why to resolve my problem?

 Thanks in advance.

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


Re: [android-developers] Re: ListView not responding to Click or KeyPress

2009-12-04 Thread Romain Guy
This is unnecessary. This problem will occur if your list item
contains focusable children (like buttons, edittexts, etc.)

On Thu, Dec 3, 2009 at 4:20 PM, hwii77 hwi...@gmail.com wrote:
 maybe maybe try this: Add android:clickable=true  (and
 android:focusable=true)

 On Dec 2, 1:37 pm, n179911 n179...@gmail.com wrote:
 Hi,

 I have a simple ListView in my layout.xml file.

     ListView android:id=@+id/action_list
             android:layout_width=fill_parent
             android:layout_height=wrap_content
         /

 And in my javacode, I add a setOnItemClickListener() to my listview:

 listView.setOnItemClickListener(new OnItemClickListener() {

                 public void onItemClick(AdapterView? parent, View view,
 int position, long id) {
                     System.out.println (get onItem Click position=
 +position);

                 }
             });

 But when I run on G1. I don't see any print out when I click an item on the
 ListView on the phone.
 Or when I select an item using track ball and press CENTER.

 Can you please tell me why to resolve my problem?

 Thanks in advance.

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




-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

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


Re: [android-developers] Re: ListView not responding to Click or KeyPress

2009-12-04 Thread n179911
Thank you.

On Fri, Dec 4, 2009 at 10:43 AM, Romain Guy romain...@android.com wrote:

 This is unnecessary. This problem will occur if your list item
 contains focusable children (like buttons, edittexts, etc.)

 On Thu, Dec 3, 2009 at 4:20 PM, hwii77 hwi...@gmail.com wrote:
  maybe maybe try this: Add android:clickable=true  (and
  android:focusable=true)
 
  On Dec 2, 1:37 pm, n179911 n179...@gmail.com wrote:
  Hi,
 
  I have a simple ListView in my layout.xml file.
 
  ListView android:id=@+id/action_list
  android:layout_width=fill_parent
  android:layout_height=wrap_content
  /
 
  And in my javacode, I add a setOnItemClickListener() to my listview:
 
  listView.setOnItemClickListener(new OnItemClickListener() {
 
  public void onItemClick(AdapterView? parent, View
 view,
  int position, long id) {
  System.out.println (get onItem Click position=
  +position);
 
  }
  });
 
  But when I run on G1. I don't see any print out when I click an item on
 the
  ListView on the phone.
  Or when I select an item using track ball and press CENTER.
 
  Can you please tell me why to resolve my problem?
 
  Thanks in advance.
 
  --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en
 



 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  All such questions should be posted on
 public forums, where I and others can see and answer them

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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: ListView not responding to Click or KeyPress

2009-12-03 Thread Brion Emde
You want to override the method onListItemClick(ListView l, View v,
int position, long id) instead.


On Dec 2, 2:37 pm, n179911 n179...@gmail.com wrote:
 Hi,

 I have a simple ListView in my layout.xml file.

     ListView android:id=@+id/action_list
             android:layout_width=fill_parent
             android:layout_height=wrap_content
         /

 And in my javacode, I add a setOnItemClickListener() to my listview:

 listView.setOnItemClickListener(new OnItemClickListener() {

                 public void onItemClick(AdapterView? parent, View view,
 int position, long id) {
                     System.out.println (get onItem Click position=
 +position);

                 }
             });

 But when I run on G1. I don't see any print out when I click an item on the
 ListView on the phone.
 Or when I select an item using track ball and press CENTER.

 Can you please tell me why to resolve my problem?

 Thanks in advance.

-- 
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: ListView not responding to Click or KeyPress

2009-12-03 Thread Bill
Why doesn't setting the Listener work?

On Dec 2, 5:13 pm, Brion Emde brione2...@gmail.com wrote:
 You want to override the method onListItemClick(ListView l, View v,
 int position, long id) instead.

 On Dec 2, 2:37 pm, n179911 n179...@gmail.com wrote:

  Hi,

  I have a simple ListView in my layout.xml file.

      ListView android:id=@+id/action_list
              android:layout_width=fill_parent
              android:layout_height=wrap_content
          /

  And in my javacode, I add a setOnItemClickListener() to my listview:

  listView.setOnItemClickListener(new OnItemClickListener() {

                  public void onItemClick(AdapterView? parent, View view,
  int position, long id) {
                      System.out.println (get onItem Click position=
  +position);

                  }
              });

  But when I run on G1. I don't see any print out when I click an item on the
  ListView on the phone.
  Or when I select an item using track ball and press CENTER.

  Can you please tell me why to resolve my problem?

  Thanks in advance.



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