what does the $ means in .hprof file android studio -
after initiating gc , clicking dump java heap in android studio monitor ,this image below appears
what $ next class dialogfrag in dialogfrag$1 means ? (dialogfrag class extends dialogfragment) suppose have 1 instance of class ,but can see next dialogfrag$1 total count 7 , mean have memory leak?
edit: dialog fragment class
public class dialogfrag extends dialogfragment { asynctask<void,void,void> asynctask; @override public dialog oncreatedialog(bundle savedinstancestate) { alertdialog.builder alertdialog=new alertdialog.builder(getactivity()); alertdialog.settitle("solution:"); view view = getactivity().getlayoutinflater().inflate(r.layout.dialogfrag,null); final myview myview= (myview) view.findviewbyid(r.id.myview); myview.setvisibility(view.invisible); alertdialog.setview(view); asynctask=new asynctask<void, void, void>() { @override protected void doinbackground(void... voids) { //compute here } @override protected void onpostexecute(void param) { super.onpostexecute(param); getdialog().findviewbyid(r.id.progress).setvisibility(view.gone); myview.setvisibility(view.visible); } }); asynctask.execute(); alertdialog.setpositivebutton("show", new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialoginterface, int i) { if(!(asynctask.getstatus()== asynctask.status.finished)){ asynctask.cancel(true); } asynctask=null; dismiss(); } }); alertdialog.setnegativebutton("cancel", new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialoginterface, int i) { if(!(asynctask.getstatus()== asynctask.status.finished)){ asynctask.cancel(true); } asynctask=null; dismiss(); } }); dialog dialog=alertdialog.create(); dialog.getwindow().getattributes().windowanimations = r.style.mydialogviewanimation; return dialog; } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { getdialog().getwindow().setgravity(gravity.center_horizontal | gravity.top); getdialog().requestwindowfeature(window.feature_no_title); return super.oncreateview(inflater, container, savedinstancestate); }
what $ next class dialogfrag in dialogfrag$1 means ?
$number
means anonymous inner class, example new view.onclicklistener() {...}
.
but can see next dialogfrag$1 total count 7 , mean have memory leak?
maybe, did rotate phone 7 times?
remember unregister listeners , broadcastreceiver
s in appropriate lifecycle methods. try avoid static fields.
Comments
Post a Comment