[android-developers] Re: UI troubles with Android 2.2

2010-10-07 Thread Thibaut
The second trouble is resolved thanks to another message in this
google group ( 
http://groups.google.com/group/android-developers/browse_thread/thread/4e8ad65d5cc7f103/c0986e9ad4e655e2
). Nested scrollviews don't work anymore.

Does anyone have an idea why several click attempts are necessary to
open the context menu by clicking on an ImageView (located inside a
ListView)?



On 6 oct, 20:30, Thibaut aar...@gmail.com wrote:
 Hello,

 I have some strange UI troubles with Android 2.2.

 First, I set an OnClickListener on an ImageView that should open the
 context menu. Nothing happens on the first click attempts, but the
 next ones trigger several context menu openings (the menu opens itself
 when a menu item is selected) ...

 Second, if the screen is landscape-oriented, a HorizontalScrollViewer
 doesn't scroll as expected. It breaks its self movements, giving the
 feeling to scroll step by step. Its behavior is normal when the screen
 is portrait-oriented.

 And everything is normal with Android 2.1.

 Thanks

 Thibaut

-- 
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: UI troubles with Android 2.2

2010-10-07 Thread Daniel Drozdzewski
On Thu, Oct 7, 2010 at 9:15 AM, Thibaut aar...@gmail.com wrote:
 The second trouble is resolved thanks to another message in this
 google group ( 
 http://groups.google.com/group/android-developers/browse_thread/thread/4e8ad65d5cc7f103/c0986e9ad4e655e2
 ). Nested scrollviews don't work anymore.

 Does anyone have an idea why several click attempts are necessary to
 open the context menu by clicking on an ImageView (located inside a
 ListView)?

Thibaud,

Where in your code do you call setOnClickListener() ? Please remember
that ListView recycles the views behind each list item.
Quick peek at your Adapter.getView() method would help here.

Daniel




 On 6 oct, 20:30, Thibaut aar...@gmail.com wrote:
 Hello,

 I have some strange UI troubles with Android 2.2.

 First, I set an OnClickListener on an ImageView that should open the
 context menu. Nothing happens on the first click attempts, but the
 next ones trigger several context menu openings (the menu opens itself
 when a menu item is selected) ...

 Second, if the screen is landscape-oriented, a HorizontalScrollViewer
 doesn't scroll as expected. It breaks its self movements, giving the
 feeling to scroll step by step. Its behavior is normal when the screen
 is portrait-oriented.

 And everything is normal with Android 2.1.

 Thanks

 Thibaut

-- 
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: UI troubles with Android 2.2

2010-10-07 Thread Thibaut
Thank you for your answer,

I call setOnClickListener() in the Activity while I create the list of
views. Then i give this list to the adapter. The Adapter::getView()
method just returns the view _list.get(position). See below for code
sample.

But I would like to say that the onclick behavior is very very strange
on that list (although everything works with Android 2.1). The last
item reacts correctly, but the previous ones seem to stack the call
and execute the whole stack as a batch when any action finally
succeeds.

In the Activity:

_listView = new ListView(this);
[ ... ]
PeriodListAdapter adapter = new PeriodListAdapter();

OnClickListener openMenu = new OnClickListener() {
@Override
public void onClick(View v) {
PeriodActivity.this.openContextMenu(v);
}
};

PeriodDescription therapyP = new PeriodDescription(this);
therapyP.setPeriod(p);
therapyP.setOnClickMenu(openMenu);
adapter.addPeriodDescription(therapyP);

[ ... ]

_listView.setAdapter(adapter);


Thanks for your interest

Thibaut, a poor disappointed developer...




On 7 oct, 11:46, Daniel Drozdzewski daniel.drozdzew...@gmail.com
wrote:
 On Thu, Oct 7, 2010 at 9:15 AM, Thibaut aar...@gmail.com wrote:
  The second trouble is resolved thanks to another message in this
  google group 
  (http://groups.google.com/group/android-developers/browse_thread/threa...
  ). Nested scrollviews don't work anymore.

  Does anyone have an idea why several click attempts are necessary to
  open the context menu by clicking on an ImageView (located inside a
  ListView)?

 Thibaud,

 Where in your code do you call setOnClickListener() ? Please remember
 that ListView recycles the views behind each list item.
 Quick peek at your Adapter.getView() method would help here.

 Daniel



  On 6 oct, 20:30, Thibaut aar...@gmail.com wrote:
  Hello,

  I have some strange UI troubles with Android 2.2.

  First, I set an OnClickListener on an ImageView that should open the
  context menu. Nothing happens on the first click attempts, but the
  next ones trigger several context menu openings (the menu opens itself
  when a menu item is selected) ...

  Second, if the screen is landscape-oriented, a HorizontalScrollViewer
  doesn't scroll as expected. It breaks its self movements, giving the
  feeling to scroll step by step. Its behavior is normal when the screen
  is portrait-oriented.

  And everything is normal with Android 2.1.

  Thanks

  Thibaut

-- 
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: UI troubles with Android 2.2

2010-10-07 Thread Daniel Drozdzewski
On Thu, Oct 7, 2010 at 2:14 PM, Thibaut aar...@gmail.com wrote:
 Thank you for your answer,

 I call setOnClickListener() in the Activity while I create the list of
 views. Then i give this list to the adapter. The Adapter::getView()
 method just returns the view _list.get(position). See below for code
 sample.

I think you have to work harder on your Adapter.getView().
Have a look at these and then fix your Adapter:

http://www.youtube.com/watch?v=wDBM6wVEO70
http://commonsware.com/Android/excerpt.pdf

Daniel




 But I would like to say that the onclick behavior is very very strange
 on that list (although everything works with Android 2.1). The last
 item reacts correctly, but the previous ones seem to stack the call
 and execute the whole stack as a batch when any action finally
 succeeds.

 In the Activity:

 _listView = new ListView(this);
 [ ... ]
 PeriodListAdapter adapter = new PeriodListAdapter();

 OnClickListener openMenu = new OnClickListener() {
       �...@override
        public void onClick(View v) {
                PeriodActivity.this.openContextMenu(v);
        }
 };

 PeriodDescription therapyP = new PeriodDescription(this);
 therapyP.setPeriod(p);
 therapyP.setOnClickMenu(openMenu);
 adapter.addPeriodDescription(therapyP);

 [ ... ]

 _listView.setAdapter(adapter);


 Thanks for your interest

 Thibaut, a poor disappointed developer...




 On 7 oct, 11:46, Daniel Drozdzewski daniel.drozdzew...@gmail.com
 wrote:
 On Thu, Oct 7, 2010 at 9:15 AM, Thibaut aar...@gmail.com wrote:
  The second trouble is resolved thanks to another message in this
  google group 
  (http://groups.google.com/group/android-developers/browse_thread/threa...
  ). Nested scrollviews don't work anymore.

  Does anyone have an idea why several click attempts are necessary to
  open the context menu by clicking on an ImageView (located inside a
  ListView)?

 Thibaud,

 Where in your code do you call setOnClickListener() ? Please remember
 that ListView recycles the views behind each list item.
 Quick peek at your Adapter.getView() method would help here.

 Daniel



  On 6 oct, 20:30, Thibaut aar...@gmail.com wrote:
  Hello,

  I have some strange UI troubles with Android 2.2.

  First, I set an OnClickListener on an ImageView that should open the
  context menu. Nothing happens on the first click attempts, but the
  next ones trigger several context menu openings (the menu opens itself
  when a menu item is selected) ...

  Second, if the screen is landscape-oriented, a HorizontalScrollViewer
  doesn't scroll as expected. It breaks its self movements, giving the
  feeling to scroll step by step. Its behavior is normal when the screen
  is portrait-oriented.

  And everything is normal with Android 2.1.

  Thanks

  Thibaut

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



-- 
Daniel Drozdzewski

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