Saturday, 15 August 2015

java - Load a different fragment into android app when clicking on a fixed tab -


Currently new to the Android OS and trying to bring my head around pieces - one from iOS app To create an app, so I need to understand this figure!

I used fixed tab default settings in Eclipse IDE, which gives me 3 tabs. I can change the tab menu name, but I am trying to load it in a separate section, it says: fragment_1 , fragment_2 and fragment_3 Code>.

I have received this code:

  Creatives on public view (Layout: Influencer Inflator, View Group Container, Bundle Saved InstantStat) {View Routview = Inflator. Float (r layout.fragment_1, container, incorrect); Textview dmtextview = (text view) rootview.findvibid (rid section_label); DummyTextView.setText (.iGenerator.toString (getArguments () getInt (ARG_SECTION_NUMBER)); Return root view; }   

And I have changed the layout to fragment_1 , but how can I load fragment_x where x tab is clicked? Is this possible? I have searched the net, but nothing has worked yet or there is no point till now!

Since you have created your project through Eclipse, in your main activity you will see DummySectionFragment < Must see a private class called / code>. Use that class as a guide to make three classes, which will be your three separate pieces (A, B & C).


/ blockquote>

now Return to content like getItem

  public piece getItem (int position) {if (position == 0) Return {New MyFreeagment (A); } And if (condition == 1) {return the new microfrject (B)); } Else {// condition == 2 new migrating C (); }}   

Where MyFragmentA / B / C are the fragements you created in the first step. Take a look before it even before experimenting.

No comments:

Post a Comment