android - java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first -


private void showsigndialog() {     dialog = new dialog(cust_my_deliveries_details.this);     dialog.getwindow();     dialog.getwindow().setbackgrounddrawable(new colordrawable(android.graphics.color.transparent));     dialog.requestwindowfeature(window.feature_no_title);     //dialog.setcontentview(r.layout.notification_dialog);     dialog.setcanceledontouchoutside(true);      layoutinflater layoutinflater;     layoutinflater = layoutinflater.from(cust_my_deliveries_details.this);     view view = layoutinflater.inflate( r.layout.signature_bord, null);      relativelayout relativelayoutsign = (relativelayout)view.findviewbyid(r.id.relativelayoutsign);     relativelayout relative_clearsign = (relativelayout)view.findviewbyid(r.id.relative_clearsign);     relativelayout relative_oksign = (relativelayout)view.findviewbyid(r.id.relative_oksign);      relativelayoutsign.addview(signatureview);      dialog.setcontentview(view);     dialog.show(); } 

at first time application displaying dialog while try open again ,my application crashing

i think

relativelayoutsign

is parent of

signatureview

on second call.

so should write:

relativelayoutsign.removeview(); relativelayoutsign.addview(signatureview); 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -