Skip to content

Instantly share code, notes, and snippets.

@aminekarimii
Created July 6, 2019 16:06
Show Gist options
  • Save aminekarimii/59e5ce67142530ddf1d81d61f29ef684 to your computer and use it in GitHub Desktop.
Save aminekarimii/59e5ce67142530ddf1d81d61f29ef684 to your computer and use it in GitHub Desktop.
package kmzstudio.realanime;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class SampleSlide extends Fragment {
private static final String ARG_LAYOUT_RES_ID = "layoutResId";
private int layoutResId;
public static SampleSlide newInstance(int layoutResId) {
SampleSlide sampleSlide = new SampleSlide();
Bundle args = new Bundle();
args.putInt(ARG_LAYOUT_RES_ID, layoutResId);
sampleSlide.setArguments(args);
return sampleSlide;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null && getArguments().containsKey(ARG_LAYOUT_RES_ID)) {
layoutResId = getArguments().getInt(ARG_LAYOUT_RES_ID);
}
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
return inflater.inflate(layoutResId, container, false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment