Hi all,
I've read this:
https://www.b4x.com/android/forum/threads/callsub-when-activity-paused.55533/
but I can't figure if is possible to draw on Canvas (on background) while the app stay paused.
I'm explain better here:
I've developed an app that load gcode files, parse it, draw on Canvas and then send over USB to printer controller line by line, every line wait an acknowledgment from controller "ok" before send next line.
To do this I've used an Activity (default Main activity) and wrote some classes, like Connector to connect over USB, Viewer that have a big Canvas on one panel and then all is inside a ScrollView2D to scoll it, this class shows gcode X,Y,Z movements on a canvas, and a Service that manage all app and USB, so even the data arrival (ACK from printer)
Because a USB (Connector Class) need continue to send and receive from, even if app is pauses, I've declared it on the Service, but my Viewer class I put it on the Main activity because contains some views like a Canvas.
If I switch and send app in Pause the USB continue to send and receive, but how to draw on Canvas on the same time?
What I need is not to show the Activity, but continue to draw on Canvas in background, so when I Resume the app and I see the Activity I can see the draw updated as the Activity never go in pause.
I've tried with CallSub, but because the Activity is paused, it do nothing.
I've tried CallSubDelay, but it just send some calls to a queue, and then if I resume the Activity I can't see Canvas updated.
Is there a way to do this?
Many thanks
I've read this:
https://www.b4x.com/android/forum/threads/callsub-when-activity-paused.55533/
but I can't figure if is possible to draw on Canvas (on background) while the app stay paused.
I'm explain better here:
I've developed an app that load gcode files, parse it, draw on Canvas and then send over USB to printer controller line by line, every line wait an acknowledgment from controller "ok" before send next line.
To do this I've used an Activity (default Main activity) and wrote some classes, like Connector to connect over USB, Viewer that have a big Canvas on one panel and then all is inside a ScrollView2D to scoll it, this class shows gcode X,Y,Z movements on a canvas, and a Service that manage all app and USB, so even the data arrival (ACK from printer)
Because a USB (Connector Class) need continue to send and receive from, even if app is pauses, I've declared it on the Service, but my Viewer class I put it on the Main activity because contains some views like a Canvas.
If I switch and send app in Pause the USB continue to send and receive, but how to draw on Canvas on the same time?
What I need is not to show the Activity, but continue to draw on Canvas in background, so when I Resume the app and I see the Activity I can see the draw updated as the Activity never go in pause.
I've tried with CallSub, but because the Activity is paused, it do nothing.
I've tried CallSubDelay, but it just send some calls to a queue, and then if I resume the Activity I can't see Canvas updated.
Is there a way to do this?
Many thanks
Last edited: