Couldn't find a good answer for this. I have a class(no opened from MainActivity. There I want to call startActivityForResult, to know when to do something on the UI. How do I do it correctly? I passed the activity and context to the class. On class:
private void init(){
Intent TestIntent = new Intent();
mActivity.startActivityForResult(TestIntent,MainActivity.TEST);
}
On MainActivity:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent Data) {
super.onActivityResult(requestCode, resultCode, Data);
if (requestCode == TEST){
Toast.makeText(this, "TEST", Toast.LENGTH_SHORT).show();
}
}