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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -