Show another tab than first one at starting android - android

Is it possible display one tab or another in android dynamically?
I am trying to make an app with 3 tabs but sometimes is possible that one or two tabs will not have content (not buttons or data in activities) so I want just show the activity which has data or one of both with it.
I want to keep the possibility that the user navigate to tabs without content but I want to show firstly the tab with it.
I am following this tutorial: http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/ to do the tabs. I mean, if you need my code to make any modification or add anything. For the moment I just want to have an example to show it and after that start adding my code, which already works in an older app.

You can move to the tab by using
viewPager.setCurrentItem(item_position);
getActionBar().setSelectedNavigationItem(item_position);

Related

Gmail like registration layout in Android

I often put user registration on one xml file with scroll view.
I have learned when a user sees too many fields they opt out of the app so I am planning to upgrade the layout to look like the one for gmail when you sign up on android app. It appears to be using tabbed view but not tabs available and user navigates to the next view by clicking next (refer to attached images).
First page
second page
MY QUESTION
My question is how do I create this views, do I need many xml layout files or put all stuff on one file and use visibility as in once it is filled and user presses next hide the inputs and reveal the next inputs. Note: Gmail appears to be scrolling to another page the way it would appear when using tabs.
You can use one activity to host multiple fragments. The new Android Studio update has Navigation Editor which you can use to achieve similar results.
it is totally up to you how you want to design this but the best thing is you use Fragment and viewpager instead of using two separate layouts.
See Here how to use fragment with viewpager
There are many ways to do this, If you have less content then play with visibility otherwise ViewFipper ( https://abhiandroid.com/ui/viewflipper ) Or can use Fragments

How do I make an Android activity like shown in this image?

How do I make an Android activity like the one shown in this image.
I am asking specifically about how to make a component such as the repeat and reminder components. And also, the two tabs showing Add Event and Add Task.
I'd also like to know the name by which they are referred.
Touching Repeat, a list dialog box appears. Touching Reminder, different times can be set which can be removed by a minus sign (-) which appears beside them. The tabs cannot be slid, but they need to be clicked to go to a particular tab.
It looks like it's just a listview on top of a tabbed activity.
When you create a new Activity, you can just specify tabbed activity and Android studio takes care of creating the tabs.
Then for the items, you just use listview, unless it'll turn out to be a really long list, then a recyclerview is recommended.
Hope that helps (:

Android Sample - SlidingTabsColors - How to select a perticular tab

I am creating my first ever android app. For this I have followed this example to create a very nice sliding tabbed layout.
It's very good, but there is a small problem.
I have created about 5 tabs, each supported by 5 different fragments containing their own controls. When I exit the app with back button and start it again, all my controls on each page retain their state (using my Singleton parameters class). But on each reopening, the app starts with first tab selected. Even if I was working on 5th tab and existed from there, the app shows the first tab only.
I could keep the tab index in my singleton class, but how do I set it such that the app always opens with last open tab using something like setSelectedTab(tabIndex)? And where should I call this method?
Thanks a ton in advance for the help.

How to implement Tabs UI in android

I have existed code for two activities(ActivityA and ActivityB).
Now I need to have a another activity, which will act as my first and only screen of my application. This activity will be having two tabs on its header part and I need to display each of my Activity when user press on each tab.
I have done some search on this and found TabAcivity will be suitable choice, but it is deprecated now.
I saw many posts which are suggesting Fragments. But I dont want to change my existing code. Can any one suggest me easy method to incorporate this.
you can use Android Tab Layout with Swipeable Views
here i give Link in this link step by step information given. so i think you can get batter idea from that.
Tab Layout with Swipeable Views
you can also download code from this site and also see video in given sit

How to have access to mutliple views in one tab of the tab bar in android?

I am having 3 tab in the tab bar.I would like to have an access when we we click the first tab it need load the Activity 1<->Activity 2 <->Activity 3 <->Activity 4.How to get this,any examples on this will be helpful. I have tried all other examples with single activity but when I try to call the multiple activities no luck on it.Thanks
As I got from your question is that your requirement is to have Sub-Activity inside a Single Tab. You can use ActivityGroup for that, but now it is deprecated you can use Fragments Compatibility Package which works from 1.6 version too. So, here is an example for that FragmentTabs.java

Categories

Resources