insider_ank
insider_ank

Reputation: 1

Text display in random position in all other activities of app, by triggering from one activity

I have Main, Home activities are there Launcher app side (.apk). PlayActivity, Profile, and Init are there on the library side (.aar)

from the server side 1 message will trigger, then I want to show that message in PlayActivity until getdisplayperiod is over it has to display in the same position in all other activities if we navigate. Again it has redraw if it is there in PlayActiviy.java in another random position. If it is there in the same activity it has to display till getdisplayperiod and disappear till totalperiod-getdisplayperiod again it has to display. If it is there in another activity after getdisplayperiod there is no need for redraw.

How to achieve a solution for the above problem?

I have tried with overlay, but all Android boards don't have permissions.

Upvotes: 0

Views: 98

Answers (1)

user27894462
user27894462

Reputation: 319

When you display the message in Activity A, use a flag like "shouldDisplay = true"; and reset it to false when you close the message. And in onPause of activity A, if "shouldDisplay" is true, either save the flag and remaining time to a sharedpreference file or use an intent. And in activity B's onCreate (or wherever you want) access that sharedpreference file and if the value is true, display the message again / receive the intent and display the message based on the remaining time. Once total time is over, reset the flag to false in sharedpreference file. You can also save content of the message to sharedpreference file / share it via intent if the message isn't static

Upvotes: 0

Related Questions