Android tab activity - android

hi all
i have a tab activity in which there four tabs
now this activity can be started by three other activities
based on the activity that started the current tab has to be set in the tab activity
i tried using extras specifying which should be the current tab in the intent that started the tabactivity
but it dont seem to realize the extras at all

You can do it using
myTabHost.setCurrentTab(2);
method. So just pass the tab id you want to display first with intent. Use it in your myTabActivity.java to display the tab you want.

Related

Disable TabBar for specific Tab when keyboard is up

I need to disable showing the tab bar above keyboard when its up for only specific tab.
I've searched and tried several ways:
android:windowSoftInputMode="stateVisible|adjustResize|adjustPan" works but for all tabs. I need only for one tab
The only way i think should work is to send broadcast from the tab fragment to the TabActivity, it works fine but when dealing (typing/deleting) with the only edit text in the fragment something goes wrong in the tab bar goes up with the keyboard again.
The broadcast is: (Tab fragment):
Intent intent = new Intent(TabActivityName.ACTION_SET_SOFT_INPUT_MODE);
intent.putExtra(TabActivityName.SOFT_INPUT_MODE, WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
getActivity().sendBroadcast(intent);
And from the TabActivityName the broadcast is being called successfully and do:
getWindow().setSoftInputMode(intent.getIntExtra(SOFT_INPUT_MODE, 0));
So my main issue is what can cause the tab activity to disable/reset/forget this softInputMode
thank for the help

Android :: one activity in two tabs?

I am working on a Tab Activity. I have one activity as a tab content
of one tab. I need to use the same in another tab also.so I have set
the a single activity as a two tab content. But when I am running my
code . If I am selecting the TAB1 after that I am selecting TAB2.
Again I coming back to TAB1. whatever event like entering name in
edittext is reflecting in TAB2 not in TAB1.I don't know understand why
its happening.
Any Idea? Thanks in Advance.
You haven't mentioned that what you are doing onTabChanged ie. whether you are starting that activity again or not.
I think everytime when you are selecting a tab you are staring an Activity.
startActivity(intent);
So, whatever change you have made in that activity under Tab2, won't reflect on that activity under Tab1 as you are starting that activity again.
If you are starting that activity everytime ontabchanged, then you have to save the changes what you have made under any tab.
As you haven't mentioned clearly what you are doing, so if you are doing something else, let me know.

tab host and multiple activities (UINavigationController equivalent)

I'm currently porting iOS App to Android
the iOS app uses tabbar + navigation controller (inside each tab) to load multiples Views
I would like to keep the same design on Android, but I'm a bit confused with it
I tried "startActivityForResult" to load another activity the TabHost is removed
I also tried to replace the view with setContentView, I'm working, but as some tabs requires more than 10 sub screen, the code will be very elegant.
So I'm looking for a solution to load another Activity in the same tab with a UINavigationController like features
Ex: If I have three tabs A, B, C, on tab A I can go to A1 while pressing some button, If I push back button, I would like A to be displayed
You can go either with Fragment or with ActivityGroup.
Fragment is the latest solution where as ActivityGroup is deprecated.
You can refer:
Activity Group => this, this, this, this
Fragment => this, this

How to run the Tabbar without clicking the Tabs in Android

I have a Tab bar application with two tabs named "Tab1" and "Tab2".
Whenever I launch the application ,the Tab Bar runs and the "Tab1" in the Tab Bar get selected and it runs an Activity, because I have used setCurrentTab(0) method.
So how can I run the Second Tab named "Tab2" simultaneously along with the "Tab1" without clicking. Here I cannot use setCurrentTab(1),because I have already used setCurrentTab(0).
Any suggestions as to how I can do this?
first navigate to the second tab then come to the first tab.
setCurrentTab(1);
setCurrentTab(0);
so the second tab will be onPause state do whatever you want to do on second tab.

Start activity in tab using fragment

I have tab activities (tab1, tab2).
When button1 is pressed in tab1 activity it covers up the whole screen. How to start another activity in the same tab?
Is it possible to start ContactsContract.Contacts.CONTENT_URI in tab1?
Check FragmentTabs.java example in the documentation.

Categories

Resources