Android Question I need call a dialog in a class declared in service

rosippc64a

Active Member
Licensed User
Longtime User
Hi All!
I have a printer class that I declared in the starter to allow printing to continue in the background regardless of anything. The printer class also contains a bluetooth class, because I use a BT printer. When I start using a new printer, the bluetooth class wants to connect to it and offers a list for the client to choose the right one. This of course ends up with an error, which has been mentioned in forum (android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?), but no solution. How to call a dialog from service or avoid this call? I have tried using callsub from class to call a procedure in main which calls nicely, but I can't return the chosen value to a dynamically created class.
Can anybody suggest something?
 

DonManfred

Expert
Licensed User
Longtime User
How to call a dialog from service or avoid this call?
You can´t.
I have tried using callsub from class to call a procedure in main which calls nicely, but I can't return the chosen value to a dynamically created class
You can call a sub in the service from the Activity to submit the Value.
In this sub you use the dynamically created class to submit the value (property, method in the class, whatever) to.
 
Upvote 0
Top