Android Question Non-modal box on top of my activities!

artsoft

Active Member
Licensed User
Longtime User
Hi!

Currently, I need to handle an internal new state (before: False / now: True) in my app for exactly 1 minute (working with a timer object).
After this minute, the old internal state (False) should be set back.

But the user should see the timer value everytime, no matter what he does.
So the user can start, open or finish other activities while the timer is running and the box is on top visible.

In all user actions (within the app), a non-modal box (another activity?) should be displayed always on top of all - until the timer has reached its last tick.
Then the box should be closed by the timer (or within the timer tick method):

Non-Modal-Box.png


The main question is: Is that even feasible? ... Is there any way to realize such a box?

Thanks in advance for your help.

Best regards
ARTsoft
 

artsoft

Active Member
Licensed User
Longtime User
The quicker you switch to B4XPages, the quicker everything will become simpler.

You can show an activity from the starter service. You need to make sure that the app is visible before you show the activity.

Thanks Erel!

But how I can show an activity (via starter) which is smaller than the current screen. When I build an activity with the designer and show this activiy later via starter, then the acitiy comes and covers the whole screen. What I need is an activity with a label, which is located on top of the screen and remains there until a timer (in the starter) comes to its end. I have the starter, I have the timer, the starter starts the acitity and the timer finishs this activity again.

Is there a possibilty to show a "small" activity (i. e. 50dip height) which has not the focus .... means: the user can do what he want but this small activity is always visible on top of the screen.

Thanks.
 
Upvote 0

artsoft

Active Member
Licensed User
Longtime User
I tried it with the well known toast library ... it works ...... but thew toast message disappears after 2-3 seconds.

Therefore I tried the version with the internal timer ... on each timer tick the toast will be started again and again ... until the timer limit is reached. But this no effect on Android 10. At each timer tick, I wrote in the log in order to see what happens in the app. But the toast object disappers always after 2 seconds.

So this is also not a possibility for me, to have a non-model bar on top of my screen.

:-(
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

artsoft

Active Member
Licensed User
Longtime User
Dear Erel!

Your service code above is great.
I extended my starter service with it. So, I dont need a further activiy.

Only a simple label - added in the designer in each of my current activities - is completely controled now by the starter service with its timer:

B4X:
For Each module As Object In Array (Main, Activity2, Activity3,...)
    If IsPaused(module) = False Then
        CallSub2(module, "ShowInfoLabel", MessageForInfoLabel)
    End If
Next

After the timer in the starter service is finished, then I simply call:

B4X:
For Each module As Object In Array (Main, Activity2, Activity3,...)
 If IsPaused(module) = False Then
   CallSub(Module, "HideInfoLabel")
 End If
Next

And it works great - on each activity where I need this info label.

Thanks again.

Best regards
ARTsoft
 
Upvote 0
Top