I have a problem in layout.
I am using TabHost in my application. In that there are 4 Tabs.
In one of the Tab i have used 3 Buttons.
What I wanted to do is :
When i click on one of the Button, the TabHost and the Button should remain as it is and it should display me the contents (Set according to onClickListener) in that activity itself.
Take a look at the answer of this question: Changing the view within the Android Tab Widget
Ok, but the thing i don't understand: where should it show you the buttonClick result? If you want to set the activity in tab not to reload each time, you should use .addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP) in the corresponding tabspec declaration
Related
How can I add a dynamic view in a TabHost.
I have two tabs i.e. TabA and TabB. In TabA, I have 2 buttons and I want to set the layout (I have 2 different XML layout's) of TabB, depending upon the button pressed in TabA.
Can anyone help me.
Thank you!
That depends on the implementation of your TabHost. Have you used Activities or Views as Tabs?
Generally in your TabActivity you could use getTabHost().getTabWidget().getChildAt(index) or another method to get the view of a Tab.
If you use Activities as the children, you could also start a new Intent with your ActivityGroup and set a new view within the onCreate() method.
If you have problems finding examples for ActivityGroups with TabHosts, I can provide you a code sample showing you how to do it and also how to change the view within another tab by clicking a button.
![enter image description here][1]
I want to make a tab layout application, in which there are four tabs. Now I would like to set multiple layouts in one tab.
For example, the example below of a tab layout they make four tabs,
Now in the first tab (Timeline) make a button that give next page link,
press next button and other layout display in the first tab (timeline tab). So what thing do I need to do?
You have to use the ActivityGroup. Read Android tabactivity nested activities, and you will get what you want.
i have develop one application in which tab layout in main file now i would like to set tablayout inside 2nd number tab,so what thing can i do? help me.
its "tab inside tab"
I think you want to give sub-options while clicking on 2nd tab button. For that, why dont you create layout with 2-3 options as you wants. And make it visible/invisible based on the 2nd button's click.
You can make visible/invisible any view by using setVisibility(View.VISIBLE) and setVisibility(View.GONE) method.
I suppose you can't embed a TabHost inside another TabHost. You can do what #Paresh said. Implement your own view switching. If you want an entire Activity embedded - take a look at ActivityGroup or the Fragments framework which you can use through the Compatibility Framework. Good luck.
I am using TabHost in my application.
When I click on any one of the TabHost, it will display corresponding activity.
What I want is when i swipe on that activity it should display another Activity
I have used a ViewFlipper in the Activity(ChildActivity).
I am using example given here ....
The problem is : Its displaying the Activity that is loaded initially. Its not flipping the views as i wanted.
You can check out the code used in the Google I/O scheduler app. It has a class called FlingableTabHost. You would not need a ViewFlipper for this.
http://code.google.com/p/iosched/source/browse/trunk/src/com/google/android/apps/iosched/ui/ScheduleActivity.java
I would just catch the swipe on the tab's activity and then programmatically change the tab. Dont mess with something inside the tab.
Also, using viewFlippers, maybe you dont needs tabs.
Android Gestures
Swipe Action
I use Tab Widget like in documentation example TabWidget
I have two tabs, and in every tab when I press some button I need to load another different activity. My question is how to achive that I have that two tab on another activities like headers ?
I could create that tabs in new activities but it wouldn't remember choosen activity for another tab. How to solve this ?
This is not possible out of the box. The normal TabHost doesn't provide any facility to change the content of a tab after it is created. If you can use views as your tab content, you can, however, flip between the views within a tab so that to get the effect you are after.
If you absolutely must use a new Activity, then you will have to implement your own TabHost which allows swapping tab content after it is created.