darylbrewer / android-scripting

Automatically exported from code.google.com/p/android-scripting
0 stars 0 forks source link

non-blocking event reading functions "losing" events & event posted with eventPost() not getting read #621

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What device(s) are you experiencing the problem on?
Galaxy S2

What firmware version are you running on the device?
SL4Ar5x15

What steps will reproduce the problem?
1. i'm trying to get a non-blocking eventloop for FullScreenUI (as part of a 
wrapper class) i tried using both eventPoll & eventWait(1) ie a timeout. When I 
use the blocking eventWait(), all UI events are caught perfectly... 

however, when i try eventWait(1) with a timeout to get a non-blocking loop, 
only one in multiple keypress/button presses register - why are events getting 
"lost" from the queue? With eventPoll(1) instead of eventWait(1), even the 1 in 
several events being caught doesn't seem to happen.

<code>
def eventloop():

    while True:
        event=droid.eventWait(1)

        print event

        if(event.result!=None):
            if event.result["name"]=="key":
                if(event.result["data"]["key"]=='4'):
                    return

            if event.result["name"]=="click":
                if(event.result["data"]["id"]=="but_exit"):
                    droid.eventPost("FullScreenUI_Start","asdfa",True)

            if event.result["name"]=="screen":
                if event.result["data"]=="destroy":
                    return
</code>
2. You may notice i'm also trying to post an custom event on button press... 
again this doesn't seem to registet at all on eventWait()

Am i missing something in my understanding of how events work in SL4A?

Original issue reported on code.google.com by srinathd...@gmail.com on 16 Apr 2012 at 5:48

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by srinathd...@gmail.com on 16 Apr 2012 at 5:51

GoogleCodeExporter commented 9 years ago
I noticed the same behaviour since SL4A_r5 using Location or Sensing Facades. 
eventPoll returns always Result(id=x, result=[], error=None) - the only way to 
use Location and Sensing Facades is eventWait (see attached file). This 
behaviour has changed in SL4A_r5, it was correct in SL4A_r4.

Original comment by Nikolaus...@gmail.com on 25 Apr 2012 at 2:48

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in r5x18

Original comment by rjmatthews62 on 30 Apr 2012 at 2:09

GoogleCodeExporter commented 9 years ago
sl4aR6 same problem on samsung galaxy S+. if i use eventWait(1) its lost a 
events. I try to use eventPost(..,..,True) and eventPoll(1) but steel not 
working. 

Original comment by audis...@gmail.com on 5 May 2015 at 11:58