android-tabhost

Android - Tabhost working in Activity class

烈酒焚心 提交于 2019-11-28 08:34:21
OK, I must be overlooking something silly because I am unable to get my tabhost to display in my Activity class. I am getting the dreaded force close when I try to run the app. It will work if i extend TabActivity, but I can't do that [see edit below] because once I move the code from my prototype project its going to be in a custom class that inherits from Activity. Here is the XML layout: <?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent">

Android TabHost - Activities within each tab

旧街凉风 提交于 2019-11-28 07:05:55
I'm trying to create multiple Tabs, each with a different Activity. The only downside is i'm using a custom layout file thus my class extends an Activity rather than a TabActivity . While trying to run, it fails and suggests calling TabHost.Setup(ActivityGroupManager agm) Anyone have an idea/practical example of how this can be achieved? Thanks in advance This is a sample of my activity that also doesn't extend from TabActivity: protected TabHost tabs; // ... /** * Init tabs. */ private void initTabs() { tabs = (TabHost) findViewById(R.id.tabhost); tabs.setup(); tabs.setBackgroundResource(R

Updating Android Tab Icons

混江龙づ霸主 提交于 2019-11-28 04:29:42
I have an activity which has a TabHost containing a set of TabSpecs each with a listview containing the items to be displayed by the tab. When each TabSpec is created, I set an icon to be displayed in the tab header. The TabSpecs are created in this way within a setupTabs() method which loops to create the appropriate number of tabs: TabSpec ts = mTabs.newTabSpec("tab"); ts.setIndicator("TabTitle", iconResource); ts.setContent(new TabHost.TabContentFactory( { public View createTabContent(String tag) { ... } }); mTabs.addTab(ts); There are a couple instances where I want to be able to change

FragmentTabHost & Fragments - How do I pass data between tabs?

南笙酒味 提交于 2019-11-28 04:22:04
问题 I have a MainActivity (FragmentActivity) that has a FragmentTabHost. public class FragmentTabs extends FragmentActivity { private FragmentTabHost mTabHost; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_tabs); mTabHost = (FragmentTabHost)findViewById(android.R.id.tabhost); mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent); mTabHost.addTab(mTabHost.newTabSpec("classA").setIndicator("Class

Android. How to change Activity within a Tab

不打扰是莪最后的温柔 提交于 2019-11-28 03:43:13
Following situation: I have TabActivity with e.g. three tabs, TabA, TabB, TabC. There are a button in activity (Act_C_1) of TabC. So if the user clicks on that button, another activity (Act_C_2) should occur in TabC. I thank you in advance for any suggestions / or ideas. Mur UPD: Here is my code TabActivity with three Activities: public class TabScreen extends TabActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tab_menu); TabHost tabHost = getTabHost(); // The activity TabHost TabHost.TabSpec spec; // Resusable TabSpec for

FragmentTabHost bottom TabWidget

本秂侑毒 提交于 2019-11-27 22:45:24
问题 Hello How I can create bottom TabWidget in FragmentTabHost ? My xml looks line this: <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <FrameLayout android:id="@android:id/tabcontent" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" > <FrameLayout android:id="@+id/realtabcontent" android:layout_width="match_parent" android:layout_height="fill

Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'

匆匆过客 提交于 2019-11-27 22:27:29
I have a problem: Java Code public class VisualizzaListaActivity extends TabActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TabHost tabHost = getTabHost(); // The activity TabHost TabHost.TabSpec spec; // Reusable TabSpec for each tab Intent intent; // Reusable Intent for each tab // Create an Intent to launch an Activity for the tab (to be reused) intent = new Intent().setClass(this, DaAcquistareActivity.class); // Initialize a TabSpec for each tab and

Custom Back Stack for each Fragment in TabHost in Android

孤者浪人 提交于 2019-11-27 21:41:51
Since the TabActivity is deprecated I tried to replace it with Fragments which has been already mentioned in developer android website. But as you guys already know there was an issue about replacing tabs with fragments, since there will be only one activity ,which is Fragment Activity, there is no back stack for each of the fragments and as you can see in the other SO questions most of the developers were saying that you need to manage your own custom back stack as a solution. I have created and implemented my own custom back stack as you can see below, it works perfect I can track each

Android - TabActivity with Transition animation

眉间皱痕 提交于 2019-11-27 20:54:55
I'm trying to add an animation to my TabActivty. For example, when the user select the 2nd tab, I want the new activity comes from the right. When the user select the first tab, I want the activity comes from the left. I've found how to add one animation, but I want to add one again. Here is the code I'm using: public Animation inFromRightAnimation() { Animation inFromRight = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); inFromRight.setDuration(240); inFromRight

OnClickListener on Tabs not working

此生再无相见时 提交于 2019-11-27 19:55:14
Greetings, I am trying to get the Click - event when clicking on the currently selected tab of my TabActivity. The onTabChangedHandler is only called whenever the tab is changed, not if the currently active Tab is clicked. The debugger tells me i have the onClickListener Registered for the TabWidget within my TabHost. Am i registering for the wrong View? Also, I am unable to create a Context Menu for the Tabs, only for its content, is this problem related? public class TestDroidViewTab extends TabActivity implements TabContentFactory , OnTabChangeListener, OnClickListener { private static