This is how you would do it:
In MainActivity:
ClassBAsyncTask mat = new ClassBAsyncTask(this, .., ..);
ClassBAsyncTask's contructor:
public ClassBAsyncTask(MainActivity context, .., ..) {
mContext = context;
....
....
}
To call MainActivity's method test(List<DATA>)
from within ClassBAsyncTask
:
((MainActivity)mContext).test(yourListVariable);
Look into weak references to make sure that the AsyncTask
does not use mContext
when the activity no longer exists.