You can create getInstance
method in your activity
then call the method through it as following:
class MainActivity extends Activity{
private static MainActivity sMainActivity;
@override
private void onCreate(Bundle bundle){
sMainActivity = this;
And create the get method
public static MainActivity getInstance() {
return sMainActivity;
}
Then in your adapter
call the following line:
MainActivity.getInstance().fillData();
Note: Make sure that the activity
is currently opened to avoid any NullPointerExceptions