Android Question Problem mit 2 Activity

D

Deleted member 103

Guest
Hi,

2 Activity and a behavior I do not understand. :(

I activate Activity-2 and send it in the background.
1) when I start the app from the display then Activity-2 is open.
2) when I start the app from status bar then Activity-1 open.

Is that correct so or I do something wrong?
Should not be always Activity 2 opened?
 

Attachments

  • Activity2.zip
    11.4 KB · Views: 251

DonManfred

Expert
Licensed User
Longtime User
Should not be always Activity 2 opened?
Only one Activity can be in foreground.
I activate Activity-2 and send it in the background.
1) when I start the app from the display then Activity-2 is open.
This is because the starter service reactiivate act2.
2) when I start the app from status bar then Activity-1 open.
This happens because you set Main as the Activity to use in your notification.
 
Upvote 0
D

Deleted member 103

Guest
@somed3v3loper
thanks for the answer.

@DonManfred
This happens because you set Main as the Activity to use in your notification.
That is when I should change to "Sub Activity Pause" the notification, for example, so?
Activity-Main:
B4X:
Sub Activity_Pause (UserClosed As Boolean)
    If UserClosed Then
        StopService(Starter)
        ExitApplication
    Else
        Starter.n.SetInfo("Activity2","", Me)
    End If
End Sub
Activity-2:
B4X:
Sub Activity_Pause (UserClosed As Boolean)
    If Not(UserClosed) Then
        Starter.n.SetInfo("Activity2","", Me)
    End If
End Sub

I will just try it. ;)
 
Upvote 0
D

Deleted member 103

Guest
OK, I've tried, so it does not go!
It's better if I leave the Notification off.
Or is there a different way?
 
Upvote 0
Top