popupwindow - My Popup window is not closing when the button is pressed twice in android -


hi trying put custom popup in layout popup showing properly. if button in pressed once , click dismiss or outside area closing when button pressed twice popup not closing. can suggest on below code.

                 popupview = getlayoutinflater().inflate(r.layout.word_meaning, null, false);                           popupwindow = new popupwindow(                            popupview,                             100,                                    100, true);                 dismiss = (button)popupview.findviewbyid(r.id.dismiss);                 popupwindow.setoutsidetouchable(true);                 popupwindow.setfocusable(true);                 // removes default black background                 popupwindow.setbackgrounddrawable(new bitmapdrawable());                 dismiss.setonclicklistener(new button.onclicklistener(){                     @override                     public void onclick(view v) { system.out.println("dismiss");                         // todo auto-generated method stub                         popupview.setvisibility(view.gone);                         popupwindow.dismiss();                         //system.out.println("view"+popupview.getvisibility());                     }});                 popupview.setvisibility(view.visible);                 rel_layout.addview(popupview); 

if trying use button native device want put closing action in onbackpressed() method in activity. ie

public void onbackpressed(){     //code } 

Comments

Popular posts from this blog

design - Custom Styling Qt Quick Controls -

Unable to remove the www from url on https using .htaccess -