Pergunta

I would like to present series of pop-ups to the user when he uses the application for the first time. The pop-up will contain help messages (ex. click here to do something, swipe to view...). Once the popup is clicked it will be dismissed, displaying the next one.

Is there any short way to do this?

Any ideas (or best practices) how to do this will be appreciated.

Thank you

Foi útil?

Solução

Use a SharedPreference as a flag which is checked when the activity is run. If it isn't set on the first run, show the popups using a DialogFragment. After they've seen all of the popups, set the flag to hide them on future runs.

Outras dicas

Android does provide dialog helpers like AlterDialog.Builder Usually that is enough for most dialogs.

But beware, Android does not support synchronous dialog calls. Instead every dialog is only shown after your code is being executed. The reason for this is that otherwise the UI thread would be blocked. So in order to achieve a series of dialogs or any other workflow that requires code execution to pause until a dialog is closed needs a work around.

I achieved this by using the command pattern to have code executed after a certain dialog button is clicked. But this might not be feasible for every use case, so you might have to come up with something wacky :-(

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top