I'm trying to get a pop up text box, with some disclaimer and app info at the start of my Android application's launch. Does anyone know how to implement this? Also could it read from a txt file?
Thanks
There are two steps to displaying a message. First, you create a Snackbar object with the message text. Then, you call that object's show() method to display the message to the user.
The terms pop-up notification, toast, passive pop-up, snackbar, desktop notification, notification bubble, or simply notification all refer to a graphical control element that communicates certain events to the user without forcing them to react to this notification immediately, unlike conventional pop-up windows.
A popup notification is a message that appears on your users' browser or desktop. They're designed to grab your audience's attention and engage them in some way.
If you want a Popup that closes automatically, you should look for Toasts. But if you want a dialog that the user has to close first before proceeding, you should look for a Dialog.
For both approaches it is possible to read a text file with the text you want to display. But you could also hardcode the text or use R.String to set the text.
You can use Dialog to create this easily
create a Dialog instance using the context
Dialog dialog = new Dialog(contex);
You can design your layout as you like.
You can add this layout to your dialog by dialog.setContentView(R.layout.popupview);//popup view is the layout you created
then you can access its content (textviews, etc.) by using findViewById
method
TextView txt = (TextView)dialog.findViewById(R.id.textbox);
you can add any text here. the text can be stored in the String.xml file in res\values.
txt.setText(getString(R.string.message));
then finally show the pop up menu
dialog.show();
more information http://developer.android.com/guide/topics/ui/dialogs.html
http://developer.android.com/reference/android/app/Dialog.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With