Can I remove the activity without UI from bach stack?
I have a activity ShareAct which without UI to contain the share logic use Facebook sdk. The ContentAct is the activity to show the content.
ContentAct -> ShareAct -> Facebook sdk
The ShareAct has no view but onActivityResult() method to process Facebook's return result.
The problem is after share from Facebook sdk, the ShareAct went to front, but it has no UI. If I called ShareAct's finish() after calling Facebook sdk, the onActivityResult() will not be called.
Can I remove the ShareAct from bach stack but let it's onActivityResult() be called normally? Or is this not the right way to use activity?
Code of ShareAct is something like below:
public class ShareAct extends BaseAct {
CallbackManager callbackManager;
ShareDialog shareDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
callbackManager = CallbackManager.Factory.create();
shareDialog = new ShareDialog(this);
shareLink(...);
// finish();
}
private void shareLink(String url, String title, String desc, String imagePath) {
if (ShareDialog.canShow(ShareLinkContent.class)) {
...
shareDialog.show(linkContent);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
callbackManager.onActivityResult(requestCode, resultCode, data);
}
}