I have a couple AsyncTask classes in my main activity, each of which fetches some small amount of data from outside, stores them in memory, and then calls a method in the main activity for displaying the data. I'd like to move these classes to their own files, but they reference methods and variables from the main activity. One solution someone mentioned was to pass the activity Context into the AsyncTask like so in order to call the activity methods you want:
((ActivityName)mContext).methodYouWant(...)
((ActivityName)mContext).varYouWant
Is this the right way to access methods/members of the main activity from an external class?