Saturday 15 August 2015

Android: Load activity or intent from fragment page -


I am trying to load an activity from within a piece. I just used Base Android sample code and added some different layouts. The code below works partially, however, the intent / activity starts swiping on page 3 and not just page 4. I think this has begun even once when swiping from page 3 to page 2. I think it all on some pages to swipe with Android will ease to preload

Is there any way to any activity load when you swipe from one piece page to another is? Or maybe I actually swipe to the right page after launching the activity in some roundabout ways? I have not found any other error besides undesirable behavior.

  public static class DummySectionFragment piece extends {/ ** * part of the section number of the piece argues. * / Public static final string ARG_SECTION_NUMBER = "section_number"; Public DummySectionFragment () {} @Override public view onCreateView (LayoutInflater inflater, ViewGroup container, bundle savedInstanceState) {if (getArguments (). GetInt (ARG_SECTION_NUMBER) == 2) {LayoutInflater inflater2 = (LayoutInflater) getActivity (). GetSystemService (event .LAYOUT_INFLATER_SERVICE); See mDialogView = inflater2.inflate (R.layout.activity_main2, null); Return mDialogView; } Else if (getArguments (). GetInt (ARG_SECTION_NUMBER) == 3) {layout Inflettr inflater2 = (layout Inflatr) getActivity (). GetSystemService (References LAOUT_INFLATER_SERVICE); See mDialogView = inflater2.inflate (R.layout.activity_main3, null); Return mDialogView; } Else if (getArguments (). GetInt (ARG_SECTION_NUMBER) == 4) {layout Inflettr inflater2 = (Leautinflatr) getActivity (). GetSystemService (References LAOUT_INFLATER_SERVICE); See mIntentView = inflater2.inflate (R.layout.page_four_layout, null); Intention = Intention = getActivity (). GetApplication (), PageFourActivity.class); StartActivity; Return mIntentView; } Else {// Create a new textview and set its text to section / number of the segment argument in the segment. TextView textView = new text view (getActivity ()); TextView.setGravity (Gravity.CENTER); TextView.setText (integer.getArguments (). GetInt (ARG_SECTION_NUMBER))); Return text view; A}}    

If you are a Use ViewPager With piece , I think you should help. Look at the function as you guessed when using the ViewPager, Android normally loads pages on either side. This number can be set using. You can try to set it to 0 or something else, did not test.

No comments:

Post a Comment