how to change the Tab focus in tabhost? - android-tabhost

I am new to Android.
I am implementing coding related to tab host.
I created three tabs named tab1,tab2,tab3 in tab host.
When i am starting my application tab1 is automatically fired.
My intention is when i am starting my application tab2 is fired automatically.
with out changing thee positions.
if any one has idea please help me
Thanks in advance

Not sure I quite understand your question. If you want to set the active tab to tab #2 do the following..
TabHost tabHost = getTabHost();
tabHost.setCurrentTab(1);
TabHost.setCurrentTab sets the active tab by index. Tab 1 has index 0, Tab 2 has index 1 and so on..

Related

How to reload a particular tab in bottom navigation bar flutter?

I have a bottom navigation bar with 5 tabs, In each tab I have a button that navigates to another separate screen using Navigation.pushNamed()(page 2); and from (page 2) I pop the screen, now the tab from where I navigated from need to be reloaded. because i store some data (page 2) and stored in sqflite i need to display the data in one of the tabs. Is it possible to reload a particular tab of a bottom navigation bar?
I tried using Navigator.pop(context,true) that also didnt work. Can some one help me with this, thanks in advance.
this is done by the provider. I'm new to flutter as well but this guy explained it very well!
Flutter by default does not save state (and disposes the widgets). If you want to save the state of a tab, you can use a PageStorageBucket. It is really well described in this tutorial:
https://medium.com/#lucassaltoncardinali/keeping-state-with-the-bottom-navigation-bar-in-flutter-69e4168878e1

do i have to create smartgwt tab pane each time?

I have a constant pane for a tab which is VLayout (lets say 'Layout-A').
Since it takes time to create this layout each time, i create only once.
A Tab (lets say "Tab-A") displays this Vlayout. But it is closable.
When tab is opened for the first time, it is ok. I can see Layout-A.
But when i close and reopen this tab, i create Tab-A using 'new' and set its pane to Layout-A. Tab is empty.
Do i have to create my Layout-A each time when i open the Tab-A?
Thanks...
I didn't find the source (just a comment), but I know that in the past I did some testing on that and I was playing with
theTabSet.updateTab(indexOfTheTabToRemove, null); You can look with the console and on the elements which are destroyed.
Look at the javadoc of removeTabmethod.
So we have to set the pane to null, remove the tab which will not destroyed the pane you want to use and you will be able to reattribute to the tab when you want it.
There is one link talking about this case..... (look at the end of the post)

how to combine two project on iPhone?

I want to ask about the objective C on iPhone. I am writing a application, it contains 2 pages. The first page requires the user enter some information. The second page displays the tab page (3 tab).
And I create the first page and the second page in different project. I use the 'Window-based Application' to create the first one and use the 'Tab Bar Application' to create the second one.
However, I don't know how to combine it. Or should I build the second page in the first page project? If so, what should I do and link the tab bar? As I don't know how to create a tab bar content in the first project.
Thank you very much.
The link below might help get you started, but you'll have some difficulty with the Tab Bar Controller part. I usually create all those pieces programmatically...
http://pushplay.net/blog_detail.php?id=27
Does the "info page" collect some information and then not appear again under normal usage (e.g. a login screen)? If so, I would recommend making the "tab page" your main view, and present the "info page" modally (with presentModalViewController:animated:). It shouldn't be too hard to copy the view controller files and xib, if necessary, into the project with the "tab page".

How to add a tabController to another tabController

I have a tabController-based iPhone application. First tab is associated with a table view controller. When I select a table cell I want to show another table controller view, but with different tabs on the bottom. What is the best way to do it? Change dynamically tab entries, or do it through IB? Please advise.
Thanks,
Nava
The Apple Human Interface Guidelines really advise against this.
For example, on iPhone, iPod uses a tab bar to allow users to choose which part of their media collection to focus on, such as Podcasts, artists, videos, or playlists. The Clock application, on the other hand, uses a tab bar to give users access to the four functions of the application, namely, World Clock, Alarm, Stopwatch, and Timer. Figure 6-10 shows how selecting a tab in a tab bar changes the view in Clock. Notice how the tab bar remains visible in the different Clock modes shown in Figure 6-10. This makes it easy for users to see which mode they’re in, and allows them to access all Clock modes regardless of the current mode.
What you're thinking of doing might be possible with toolbars.
BTW, I found the best and the cleanest way to do that thanks to Rufus - iPhone Beta Dev Forum contributor: you can change the views of root tabbarcontroller anytime you want, also you can change tabbaritems title & icons. So actually I don't need 2 tabbarcontrollers, instead i change the existing one, setting its views & tabbaritems of views accordingly.

Wizard style of interface in iPhone

How would one implement a wizard style interface for the iPhone?
For instance I have a form that I would like to break down into 5
different pages or views instead of putting all the information to fill out
into one page or view.
This interface must have the ability to go prev or next in case they want
to change something on page 2 when they are on page 4.
This interface must have the ability to go to page 3 directly and still be
able to go prev and next. Seems like using UINavigationController wouldn't
work here since views 1 and 2 are not on the stack so prev would not work.
Update: Check out the "gas cubby" application. It has what I'm looking for. UITableView presents the items you can fill out. Selecting a row takes you to the detail view to enter data and prev and next to fill in other information.
UINavigationController seems like the obvious solution. It gives you nice, familiar page transitions for free, and if you need to jump to a specific page you can just set up your navigation stack without using the transition animations.
I would say use a Navigation Controller. On the 1st view, show the 5 options in a Table View. The user selects a row, and then the corresponding section is pushed onto the stack as a new UIViewController. So, if they are in view #3 and want to go back to view #1 (to be honest, I would recommend rethinking whether or not somebody in the real world will actually want to do this), they hit "back" and then select view #1 from the table.
I can't think of a better way to do this because you won't have room to do something like breadcrumbing, which Apple would recommend against anyway. You could use a tab bar but that is more like options then some sort of wizard workflow.
If you really want them to be able to skip around the process, the combination of a UINavigation controller with a UISegmentedControl to jump to sections would do what you want. You can either embed the segmented control in the nav bar or place it just below the nav bar (which seems more like what you want since you have five sections).
If the Segmented control is not quite to your taste just put up any set of five buttons to change sections and make them visually appealing.
A "wizard" UI is typically used when you have a relatively small number of steps where one step depends on the previous, at least at some steps, the results or presentation depends on previous steps. This is like a navigation tree that usually results in the use of the navigation controller, but with only one potential branch at each each step. My feeling is that the navigation UI would be perfect, but with one exception; A button on the right hand side of the navigation bar that is the left to right mirror image of the "back" button that is usually found in the left part of the navigation button. That button would navigate to the the next step, and at each step the page presented would allow the user to fill in the information for that step. The only problem then is navigating to a step not the next or previous, and this could be corrected with a custom button that includes a drop-down list of the steps in the process. And this would fit nicely with the rest of the iPhone UI, which Gas Cubby's wizard UI (as good as it is) does not.