I’m creating a Facebook application that uses many calls to Facebook’s asynchrunner class. As such, I am constantly using many callback listeners.. I have many classes that have to respond. I am finding that I cannot remember which classes are defining which callback listener result codes. I am worried that I am going to end up using the same callback result code in two different classes and this could cause serious problems. What is the best practice for organizing this? Thanks!
I’m creating a Facebook application that uses many calls to Facebook’s asynchrunner class. As
Share
I think you probably meant “request codes”, but it doesn’t matter for the purpose of this answer. I would suggest creating a separate interface to contain all these codes:
Then, whenever you need to introduce a new code, just add another
public final staticto this interface and use it likeFBCallbackCodes.AUTH_CODErather than hard-coding the values where you’re using them.This way you’re achieving two things: