Android Exception: Did you forget to call ‘public void setup (LocalActivityManager activityGroup)’

you need change MainActivity’s base class from Activity to ActivityGroup, as follows: public class MainActivity extends ActivityGroup { … } ActivityGroup will take care of an instance of LocalActivityManager. So you don’t need to create it. After the base class is changed, just call getLocalActivityManager() function defined in the base class to get that instance. … Read more

TabHost with Fragments and FragmentActivity

I would suggest creating a separate fragment file for each tab. I recently did this as well, so I have outlined my code below: Layout Files activity_main.xml <android.support.v4.app.FragmentTabHost xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@android:id/tabhost” android:layout_width=”match_parent” android:layout_height=”match_parent”> <LinearLayout android:orientation=”vertical” android:layout_width=”match_parent” android:layout_height=”match_parent”> <TabWidget android:id=”@android:id/tabs” android:orientation=”horizontal” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_weight=”0″/> <FrameLayout android:id=”@android:id/tabcontent” android:layout_width=”0dp” android:layout_height=”0dp” android:layout_weight=”0″/> <FrameLayout android:id=”@+id/realtabcontent” android:layout_width=”match_parent” android:layout_height=”0dp” android:layout_weight=”1″/> </LinearLayout> </android.support.v4.app.FragmentTabHost> tab1_view.xml … Read more

Android remove space between tabs in tabwidget

For removing the grey line at the bottom of your tabbar, you can set tabHost.getTabWidget().setStripEnabled(false); As of removing the gap between the tabs.. The best way would be to use your own drawable without any paddings. You can use images for this, or you can create your tabs’ backgrounds via xml’s, say inside a <layer_list> … Read more

Dynamically changing the fragments inside a fragment tab host?

Basic concept- We can achieve this by creating a container. Each tab will be assigned with a specific container. Now when we need a new fragment then we will replace same using this container. Kindly follow undermentioned code step by step to have better understanding. Step-1: Create Tabs for your app. Say “Home.java”. It will … Read more