java - Error: local variable event is accessed from within inner class; needs to be declared final -
i have code ask user confirm when deleting row.
@override public void onremoverecordclick(removerecordclickevent event) { sc.confirm("are sure delete ?", new booleancallback() { public void execute(boolean value) { if (value != null && value) { event.cancel(); removedata(getdataasrecordlist().get(event.getrownum())); } else { } } }); }
but got error local variable event accessed within inner class; needs declared final
how can fix this?
make change:
public void onremoverecordclick(final removerecordclickevent event)
the method execute()
needs guarantee variable event
not going disappear (be reassigned) time needed. provide guarantee declaring final. compiler knows find variable once method needs it.
Comments
Post a Comment