Android Question Shortcut in Notification Bar

Jose Cuevas

Member
Licensed User
Longtime User
Hi, I need to put a Shortcut of my App in the Notification Bar, in order to get back to App from anywhere. I already tried this:
B4X:
Dim n As Notification

n.Initialize
n.Icon = "icon"
n.Vibrate = False
n.Sound = False
n.SetInfo("Title", "Message", "")
n.Notify(1)

But when I press the notification, reload the activity. For example, in the current activity, I'm writing a text, then I press the Home button, next I press the icon of my App return to activity and the text is still there, but if I press the Home button and then I press the notification, returns to the activity, but the EditText is empty.

Is there any way that the notification works like the App Shortcut?

Thanks in advance.
 

nwhitfield

Active Member
Licensed User
Longtime User
When you press the Home button, your application is paused. You need to put some code in Activity_Pause to see if the edit text is empty, and if not, save the text to something persistent (like a Process Global, or use StateManager).

Then when the activity restarts, see if there's saved information, and if so, restore it to the EditText.
 
Upvote 0
Top