popupwindow - android popup window call from oncreate -
private void loadingpopup() { layoutinflater inflater = this.getlayoutinflater(); view layout = inflater.inflate(r.layout.loading_dialog, null); popupwindow windows = new popupwindow(layout , 300,300,true); windows.setfocusable(false); windows.settouchable(true); windows.setoutsidetouchable(true); windows.showatlocation(layout,gravity.center, 0, 0); }
when invoke method loadingpopup()
oncreate()
exception accrued .. please can help me
you trying show pop-up window before activity window has been displayed. help of post method can wait until necessary start life cycle methods completed.
try :
private void loadingpopup() { layoutinflater inflater = this.getlayoutinflater(); final view layout = inflater.inflate(r.layout.loading_dialog, null); final popupwindow windows = new popupwindow(layout , 300,300,true); windows.setfocusable(false); windows.settouchable(true); windows.setoutsidetouchable(true); layout.post(new runnable() { public void run() { windows.showatlocation(layout,gravity.center, 0, 0); } }); }
android popupwindow
No comments:
Post a Comment