Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. package kmzstudio.realanime;
  2.  
  3. import android.os.Bundle;
  4. import android.support.annotation.Nullable;
  5. import android.support.v4.app.Fragment;
  6. import android.view.LayoutInflater;
  7. import android.view.View;
  8. import android.view.ViewGroup;
  9. public class SampleSlide extends Fragment {
  10.  
  11. private static final String ARG_LAYOUT_RES_ID = "layoutResId";
  12. private int layoutResId;
  13.  
  14. public static SampleSlide newInstance(int layoutResId) {
  15. SampleSlide sampleSlide = new SampleSlide();
  16.  
  17. Bundle args = new Bundle();
  18. args.putInt(ARG_LAYOUT_RES_ID, layoutResId);
  19. sampleSlide.setArguments(args);
  20.  
  21. return sampleSlide;
  22. }
  23.  
  24. @Override
  25. public void onCreate(@Nullable Bundle savedInstanceState) {
  26. super.onCreate(savedInstanceState);
  27.  
  28. if (getArguments() != null && getArguments().containsKey(ARG_LAYOUT_RES_ID)) {
  29. layoutResId = getArguments().getInt(ARG_LAYOUT_RES_ID);
  30. }
  31. }
  32.  
  33. @Nullable
  34. @Override
  35. public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
  36. @Nullable Bundle savedInstanceState) {
  37. return inflater.inflate(layoutResId, container, false);
  38. }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement