How to create popup window?
I created one media player, its working fine. I wish to create one popup window in the media player bottom....I am searching some sample code in google but i am really confused...any one give me the idea and also some sample link.......
Element des开发者_如何学编程cription:
1. The copyright, disclaimer and buy block, this block contains links to popup
windows that contain a copyright and or disclaimer. And an option to buy the
application for the advertisement less version. The content of this block is fed trough
the application XML feed. The color of the text is fed by the application xml plus the
popup links and texts itself;
try this; http://android-er.blogspot.com/2011/06/custom-alertdialog.html
EDIT: Sorry due to restriction in my network, I couldn't able to add comments, so I am editing my answer.
What you are saying a popup widow, in Android it is Known as Dialog, which stays on the screen until user interacts with it
If you don't want user input for that then you can choose Toast, which stays specified time on the screen and disappears automatically
Study this link keenly, your confusion will come to an end: http://developer.android.com/guide/topics/ui/dialogs.html
You can use either JDialog
or JOptionPane
. Here is an example of how you can use JOptionPane
:
JPanel panel = new JPanel();
// Add whatever you want to the panel
JOptionPane pane = new JOptionPane();
JButton btnAdd = new JButton("OK");
JButton btnCancel = new JButton("Cancel");
Object[] options = {btnAdd, btnCancel};
pane.showOptionDialog(null, panel, "The Title", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, null);
精彩评论