ActivityScreens icon indicating copy to clipboard operation
ActivityScreens copied to clipboard

Open method with Fragment parameter support

Open RoRoche opened this issue 9 years ago • 1 comments

Is it possible to add a support to start Activity from a Fragment? According to the following documentation.

Actually, sometimes, it can be useful to start an Activity (and occasionally for result) from a Fragment.

So we will obtain something like this:

// Fragment section

public void open(android.app.Fragment fragment) {
    Intent intent = toIntent(fragment);
    fragment.startActivity(intent);
}

public void openForResult(android.app.Fragment fragment, int requestCode) {
    Intent intent = toIntent(fragment);
    fragment.startActivityForResult(intent, requestCode);
}

// Support fragment section

public void open(android.support.v4.app.Fragment fragment) {
    Intent intent = toIntent(fragment);
    fragment.startActivity(intent);
}

public void openForResult(android.support.v4.app.Fragment fragment, int requestCode) {
    Intent intent = toIntent(fragment);
    fragment.startActivityForResult(intent, requestCode);
}

RoRoche avatar Jun 15 '15 08:06 RoRoche

Makes sense. Also will be good with IntentBuilder suggested in #3.

kboyarshinov avatar Jun 15 '15 18:06 kboyarshinov