Using Fragment Manager
When using this method, the view XML is expected to contain a FrameLayout which acts as the container to the Fragment.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="MergeRootFrame" />
Create an instance of JuspayBrowserFragment and initialize it with one of the three strategies outlined above. Example:
JuspayBrowserFragment juspayBrowserFragment = new JuspayBrowserFragment();
juspayBrowserFragment.setArguments(initBundle);
To activate the Fragment inside this Layout, add the Fragment to the View using the FragmentSupportManager as shown below. The transition is optional. It simply adds to the effect. You can modify or remove it, if needed.
FragmentTransaction transaction = this.getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.container, juspayBrowserFragment);
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
transaction.commit();