Tabs changing when component touched

23 views
Skip to first unread message

mswhi...@gmail.com

unread,
Jan 31, 2015, 2:56:52 AM1/31/15
to codenameone...@googlegroups.com
I have a set of tabs that each display a list, each list item has a button on the right hand side that when pressed loads a detail form.

When I touch the button the tab container seems to get the notification and the selected tab changes rather than the detail form being loaded.

This is NOT a problem in the simulator but I am now testing on my Pedo Pad - Android 4.4.2.

I originally had the list set to a command list but that had the same problem.

looks like the event is being sent to the tabs component as well as the button even though I consume the event in the button ActionListener.

Shai Almog

unread,
Jan 31, 2015, 3:37:38 AM1/31/15
to codenameone...@googlegroups.com, mswhi...@gmail.com
Is it possible you swipe the tab on the device?
Did you try disabling tab swipe?

mswhi...@gmail.com

unread,
Feb 1, 2015, 5:55:00 AM2/1/15
to codenameone...@googlegroups.com, mswhi...@gmail.com
Hi,

I found the issue and not sure why it was causing the problem.

I have a list components in some of the tabs and they are set up as "Command Lists" so when a cell is touched a new form is displayed.

Before the form is displayed I call a web service to retrieve the data had the call wrapped in an InfiniteProgress() dialog.

If I remove this dialog the new form is displayed with no problem - but if I leave it then I have a problem.

No idea why this is a problem and how to display the in-progress dialog while the data loads.

Regards Mark

Shai Almog

unread,
Feb 1, 2015, 10:04:28 AM2/1/15
to codenameone...@googlegroups.com, mswhi...@gmail.com
Hi,
how is the call wrapped?
Sometimes wrapping things like this in a callSerially to flush the current EDT event cycle completely helps with such issues.

mswhi...@gmail.com

unread,
Feb 1, 2015, 6:19:43 PM2/1/15
to codenameone...@googlegroups.com, mswhi...@gmail.com
I had the following code (which I also use in another instance where all is fine):
 
 InfiniteProgress ip = new InfiniteProgress();
 dlg = ip.showInifiniteBlocking();
  
 // Call web service
 ConnectionRequest req = new ConnectionRequest(){
  @Override
  protected void readResponse(InputStream input) throws IOException
  {
   ...
  }
   
  @Override
  protected void postResponse()
  {
   ...
  }
 };
 ...
 NetworkManager.getInstance().addToQueueAndWait(req);
If I remove the "InProgress" dialog then all works fine.
 
Regards Mark 
  
 dlg.dispose();
 

Shai Almog

unread,
Feb 2, 2015, 1:25:21 AM2/2/15
to codenameone...@googlegroups.com, mswhi...@gmail.com
Try wrapping this whole block (including the dialog) in a:

Display.getInstance().callSerially(new Runnable() {
   
public void run() {
       
// all of your network code and progress dialog goes here
   
}
});

This might workaround the issue by letting the EDT complete the event cycle.
Reply all
Reply to author
Forward
0 new messages