UI Activity in the POP window in android -


i use popup window ui activity. actually, have button in main activity page on clicked should open dialog window.

in dialogue window, want have 2 other buttons in on clicked should pass value every click**(without window being disappeared)** , if there no click defined time (time-out) should vanish , return main activity.

i can using "intent" want implement automatically vanishing dialog window after time-out. how can this.? please me out problem.

thanks in advance,

first declare 1 global varialbe handler update ui control thread, below-

handler mhandler = new handler(); 

now create 1 thread , use while loop periodically perform task using sleep method of thread. suppose have menu_bt object of view show/open popup window use thread dismiss automatic popup window when there no click defined time i.e. 10 seconds.

here mpopup object of popupwindow.

use below code vanishing dialog window after time-out (i used 10 seconds).

hope you.

menu_bt.setonclicklistener(new onclicklistener() {             @override             public void onclick(view arg0) {                  view popupview = getlayoutinflater().inflate(                         r.layout.menu_popup, null); // inflating popup layout                 mpopup = new popupwindow(popupview, 400,                         layoutparams.wrap_content, true); // creation of popup                 mpopup.setanimationstyle(android.r.style.animation_dialog);                 mpopup.showasdropdown(menu_bt, 50, -10);                 button btnok = (button) popupview.findviewbyid(r.id.home);                  btnok.setonclicklistener(new onclicklistener() {                     @override                     public void onclick(view v) {                         mpopup.dismiss(); // dismissing popup button click                     }                 });                 new thread(new runnable() {                     @override                     public void run() {                         // todo auto-generated method stub                         while (true) {                             try {                                 thread.sleep(10000);                                 mhandler.post(new runnable() {                                      @override                                     public void run() {                                         // todo auto-generated method stub                                         // automatic dismissing popup after 10 seconds                                         mpopup.dismiss();                                     }                                 });                             } catch (exception e) {                                 // todo: handle exception                             }                         }                     }                 }).start();             }         }); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -