I need to use the Context of activity in the model while using MVP in android to get the list of all the installed application.what is the correct way to access the context or any alternative to achieve the same while following the MVP pattern.
Here are the classes:
Main Activity.java
public class MainActivity extends BaseActivity
    implements MainView,View.OnClickListener {
    private MainPresenter mPresenter;
    private Button sendButton;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_main);
       init();
       createPresenter();
    }
    private void init(){
       sendButton= (Button) findViewById(R.id.button_send);
       sendButton.setOnClickListener(this);
    }
    private void createPresenter() {
       mPresenter=new MainPresenter();
       mPresenter.addView(this);
    }
    @Override
    public void onClick(View view) {
       switch (view.getId()){
          case R.id.button_send:
             mPresenter.onSendButtonClick();
             break;
        }
    }
   @Override
   public void openOptionsActivity() {
        Intent intent=new Intent(this,OptionsActivity.class);
        startActivity(intent);
   }
}
Main Presenter.java
public class MainPresenter extends BasePresenter {    MainModel model;
    public void onSendButtonClick() {
       model.getListOfAllApps();
    }
    @Override
    public void addView(MainView view) {
        super.addView(view);
        model = new MainModel();
    }
}
Main Model.java
public class MainModel {
    public void getListOfAllApps(){
        final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
        mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
        final List pkgAppsList = getPackageManager().queryIntentActivities(mainIntent, 0);
  
    }
}
Having issue in getPackageManager().queryIntentActivities(mainIntent, 0) .how to do it as not having any context here.
 
     
     
     
    