Posts

Showing posts with the label android-fragments

Tabs of TabLayout not showing

Tabs of TabLayout not showing I have a main activity, which hosts a fragment, which in turn hosts a TabLayout (with a ViewPager). The tab bar is shown, baut the tabs themselves are not shown. Here is my code in the main activity for displaying the host fragment: Fragment fragment = new BMITabsFragment(); FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).addToBackStack(Constants.BMI_TABS_FRAGMENT).commit(); Here is my the Fragment which hosts the TabLayout, which is BMITabsFragment (s.a.): public class BMITabsFragment extends Fragment { ... @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onVi...

Android TabHost appears in Front of Fragments

Image
Android TabHost appears in Front of Fragments I have not been able to find a solution to this issue on any other stack posts or Android documentation. For some reason in a FragmentActivity using the support.v4 library fragments appear behind the tabhost as demonstrated in this screenshot: MainActivity.java: public class MainActivity extends FragmentActivity { // Declare Variables private FragmentTabHost mTabHost; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set the view from main_fragment.xml setContentView(R.layout.main_fragment); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); //locks screen orientation to portrait // Locate android.R.id.tabhost in main_fragment.xml mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost); // Create the tabs in main_fragment.xml mTabHost.setup(this, getSupportFragmentManager(), R.id.t...

how to update listview on backpressed in nested fragment?

how to update listview on backpressed in nested fragment? This is my Fragment where I have a list view and I am populating it with ChapterListAdapter. Curriculum Fragment public class CurriculumFragment extends Fragment implements ResponseDelegate { Context contextd; ListView curriculumList; FragmentActivity mActivity; boolean onResult=false; int requestCode, resultCode; Intent data; String courseId; private RequestedServiceDataModel requestedServiceDataModel; private ArrayList<ChapterItem> courses = new ArrayList<>(); private ChaptersListAdapter adapter; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { contextd = container.getContext(); View rootView = inflater.inflate(R.layout.fragment_circulam, container, false); courseId = getArguments().g...