Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19237] Android: convertPointToView inside a ListView

GitHub Issuen/a
TypeBug
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid
ReporterVelan Vijatovic
AssigneeEric Merriman
Created2015-06-29T08:34:58.000+0000
Updated2020-03-12T01:54:42.000+0000

Description

Hello, I'm trying to retrieve the location in the current Window of a click on a button inside a ListView. The converted location using convertPointToView() is unreliable on Android (works fine on iOS) and seems to match the button of the last visible ListItem. Here's the snippet I used https://gist.github.com/Velan/f3d75612a611b9a47568 The output on iOS (and expected output)
[INFO]  Click  {
[INFO]      x = 26;
[INFO]      y = "18.25";
[INFO]  }
[INFO]  Button title button 1
[INFO]  Converted {
[INFO]      x = "184.5";
[INFO]      y = "52.75";
[INFO]  }
[INFO]  Click  {
[INFO]      x = "44.5";
[INFO]      y = "19.25";
[INFO]  }
[INFO]  Button title button 2
[INFO]  Converted {
[INFO]      x = "203.5";
[INFO]      y = "153.75";
[INFO]  }
[INFO]  Click  {
[INFO]      x = "28.5";
[INFO]      y = "13.25";
[INFO]  }
[INFO]  Button title button 3
[INFO]  Converted {
[INFO]      x = "187.5";
[INFO]      y = "247.75";
[INFO]  }
[INFO]  Click  {
[INFO]      x = "40.5";
[INFO]      y = "17.25";
[INFO]  }
[INFO]  Button title button 4
[INFO]  Converted {
[INFO]      x = "199.5";
[INFO]      y = "351.75";
[INFO]  }
[INFO]  Click  {
[INFO]      x = 28;
[INFO]      y = "17.75";
[INFO]  }
[INFO]  Button title button 5
[INFO]  Converted {
[INFO]      x = "186.5";
[INFO]      y = "452.75";
[INFO]  }
[INFO]  Click  {
[INFO]      x = 28;
[INFO]      y = "15.75";
[INFO]  }
[INFO]  Button title button 6
[INFO]  Converted {
[INFO]      x = "186.5";
[INFO]      y = "550.75";
[INFO]  }
[INFO]  Click  {
[INFO]      x = "32.5";
[INFO]      y = "17.75";
[INFO]  }
[INFO]  Button title button 7
[INFO]  Converted {
[INFO]      x = "191.5";
[INFO]      y = "652.75";
[INFO]  }
[INFO]  Click  {
[INFO]      x = 37;
[INFO]      y = "11.75";
[INFO]  }
[INFO]  Button title button 8
[INFO]  Converted {
[INFO]      x = "195.5";
[INFO]      y = "513.75";
[INFO]  }
[INFO]  Click  {
[INFO]      x = 28;
[INFO]      y = "12.25";
[INFO]  }
[INFO]  Button title button 9
[INFO]  Converted {
[INFO]      x = "186.5";
[INFO]      y = "613.75";
[INFO]  }
The output on Android
[INFO]  Click  {"x":31.517547607421875,"y":30.885238647460938}
[INFO]  Button title
[INFO]  Converted {"x":371,"y":866}
[INFO]  Click  {"x":34.513641357421875,"y":21.813430786132812}
[INFO]  Button title
[INFO]  Converted {"x":374,"y":857}
[INFO]  Click  {"x":56.48504638671875,"y":22.733795166015625}
[INFO]  Button title
[INFO]  Converted {"x":395,"y":858}
[INFO]  Click  {"x":53.48895263671875,"y":16.659637451171875}
[INFO]  Button title
[INFO]  Converted {"x":392,"y":852}
[INFO]  Click  {"x":37.509765625,"y":23.5753173828125}
[INFO]  Button title
[INFO]  Converted {"x":377,"y":859}
[INFO]  Click  {"x":50.49285888671875,"y":21.498046875}
[INFO]  Button title
[INFO]  Converted {"x":389,"y":856}
[INFO]  Click  {"x":50.49285888671875,"y":29.4129638671875}
[INFO]  Button title
[INFO]  Converted {"x":389,"y":864}
[INFO]  Click  {"x":50.49285888671875,"y":21.34033203125}
[INFO]  Button title
[INFO]  Converted {"x":389,"y":856}
[INFO]  Click  {"x":50.49285888671875,"y":22.2607421875}
[INFO]  Button title
[INFO]  Converted {"x":389,"y":857}
I also can't seem to retrieve the title of the Button on Android. Does anybody know any workaround beside using TableViews?

Comments

No comments

JSON Source