In Android, there is a progress bar corresponding to the progress bar in other languages, that is, the progressdialog we will mention, but it is absolutely beautiful and generous,
You can generate a progressdialog object, set the title (settitle) of the pop-up progress window, set the process message (setmessage), and then display (show). You can also directly call the showl static method of progressdialog, directly display a progress box. If you set progressdialog to be cancel, you can use the mobile phone rollback key to stop it. Otherwise, only Program Internal logic to abort, through the interface and Keyboard can not abort this progress box.
See Code :
Import Android. App. activity;
Import Android. App. progressdialog;
Import Android. OS. Bundle;
Import Android. View. Menu;
Import Android. View. menuitem;
Public class testprogress extends activity {
Private progressdialog progress = NULL;
@ Override
Public void oncreate (bundle savedinstancestate ){
Super. oncreate (savedinstancestate );
Setcontentview (R. layout. Main );
}
@ Override
Public Boolean oncreateoptionsmenu (menu ){
Super. oncreateoptionsmenu (menu );
Menu. Add (0, menu. First + 1, 1, "Open progress ");
Menu. Add (0, menu. First + 2, 2, "exit ");
Return true;
}
@ override
Public Boolean onoptionsitemselected (menuitem item) {
super. onoptionsitemselected (item);
switch (item. getitemid ()
{< br> case menu. first + 1:
{< br> progress = new progressdialog (this);
progress. settitle ("Progress !! ");
progress. setmessage ("Please wait for the operation... ");
progress. setcancelable (true);
progress. show ();
// progress = progressdialog. show (this, "progress! "," Please wait for operation... ");
break;
}< br> case menu. first + 2:
{< br> finish ();
break;
}< BR >}< br> return true;
}< BR >}