Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to know which tab is active in onCreateView function?
    primarykey
    data
    text
    <p>How can I know that which tab is active in my </p> <blockquote> <p>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) function???</p> </blockquote> <p>Following code is working for just fist navigation but after that in every tab it show last layout.</p> <pre><code>public final class RobozoxFragment extends Fragment { private static final String KEY_CONTENT = "RobozoxFragment:Content"; private static int currentPosition = 100; public static RobozoxFragment newInstance(String content,int position) { currentPosition = position; RobozoxFragment fragment = new RobozoxFragment(); StringBuilder builder = new StringBuilder(); for (int i = 0; i &lt; 20; i++) { builder.append(content).append(" "); } builder.deleteCharAt(builder.length() - 1); fragment.mContent = builder.toString(); return fragment; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View myFragmentView; if(currentPosition == 1){ myFragmentView = inflater.inflate(R.layout.first, container, false); }else if(currentPosition == 2){ myFragmentView = inflater.inflate(R.layout.second, container, false); }else if(currentPosition == 3){ myFragmentView = inflater.inflate(R.layout.third, container, false); }else if(currentPosition == 4){ myFragmentView = inflater.inflate(R.layout.fourth, container, false); }else if(currentPosition ==5){ myFragmentView = inflater.inflate(R.layout.fifth, container, false); }else{ myFragmentView = inflater.inflate(R.layout.activity_main, container, false); } return myFragmentView; } </code></pre> <p>I think problem is in <code>onCreateView</code> function where I am unable to get the active tab location.</p> <p>How can i get this thing done.??</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload