Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From Layout i am getting the same Error..so,I resolve that Problem by Code only...It's working fine..Please try this code</p> <pre><code>import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTabHost; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class DetailFragment extends Fragment { /****************************************************************************************************************** * Mandatory empty constructor for the fragment manager to instantiate the fragment (e.g. upon screen orientation changes). *****************************************************************************************************************/ public DetailFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // R.layout.fragment_tabs_pager contains the layout as specified in your question View rootView = inflater.inflate(R.layout.fragment_tabs_pager, container, false); // Initialise the tab-host FragmentTabHost mTabHost = (FragmentTabHost) rootView.findViewById(R.id.tabhost); mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.realtabcontent); // Initialise this list somewhere with the content that should be displayed List&lt;String&gt; itemsToBeDisplayed; for (String subItem : itemsToBeDisplayed) { // Give along the name - you can use this to hand over an ID for example Bundle b = new Bundle(); b.putString("TAB_ITEM_NAME", subItem); // Add a tab to the tabHost mTabHost.addTab(mTabHost.newTabSpec(subItem).setIndicator(subItem), YourContentFragment.class, b); } return rootView; } } /******************************************************** This class contains the actual content of a single tab **********************************************************/ public class YourContentFragment extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras = getArguments(); if (extras != null) { if (extras.containsKey("TAB_ITEM_NAME")) { String subItem = extras.getString("TAB_ITEM_NAME"); // Do something with that string } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      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