android-tabhost

How to integrate tab host with zxing qr code scanner?

左心房为你撑大大i 提交于 2019-12-10 10:58:33
问题 I want to integrate zxing qr code scanner in my application which is having three tabs in my application. Currently when my one of the tab bar butto gets pressed at that time I am calling zxing qr code's scann activity but when ever its calling it is showing error like below. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.beepz/com.google.zxing.client.android.CaptureActivity}: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is

Why does the first tab activity in Android live forever?

二次信任 提交于 2019-12-10 10:32:47
问题 I've created a simple TabActivity which builds tabs at runtime reading some JSON data. At the moment I'm initializing an empty ListActivity with dummy random items for each tab just to see that changing from tab to tab works and the content doesn't disappear. The actual content for the tabs is stored in a singleton class, so when the tab activities get re-created due to a screen orientation change, they just pull the correct dummy items from the respective list according to an identifier

TabHost - how to change tab text in XML

谁都会走 提交于 2019-12-10 03:09:30
问题 I know the solution on how to change it programically however I would like to set the text in XML. How do you do that? I have looked here: http://developer.android.com/reference/android/widget/TabHost.html but found no solution. 回答1: How about .... <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical

Android Inflating Views of Tab View

时光毁灭记忆、已成空白 提交于 2019-12-10 00:33:36
问题 I want to implement this feature in my app as shown below. Activity with Action bar and Action Items Tabs Below the actionbar Each of the Tabs will have content. I used Tab fragments and TabListeners to code. Now when i run the app i am getting tab view but the view pager and indicator are missing. i am getting an activity as shown below. My code is as shown below. TabViewActivity .java public class TabViewActivity extends SherlockFragmentActivity { public void onCreate(Bundle

Android TabHost tabs steal focus when using Hardware Keyboard

三世轮回 提交于 2019-12-09 09:44:00
问题 I currently have a TabHost containing 4 tabs. On a few of the fragments we have a number of EditText views within the layout. We have noticed that when you attempt to type into any of the EditText views using the hardware keyboard, the focus is stolen from the EditText and given to the currently active tab in the TabHost . This only occurs on screens with tabs. Is there a quick and simple way to solve this? 回答1: This has been a known bug for quite a long time: http://code.google.com/p/android

Back button behavior with tabs and ActivityGroup

拈花ヽ惹草 提交于 2019-12-09 03:52:50
问题 I have an Activity ( Main ) which shows tabs like this: private void initTabs(){ mTabHost = getTabHost(); // The activity TabHost Intent intent; intent = new Intent().setClass(this, MyGroup.class); setupTab(intent, "tab"); } private void setupTab(Intent intent, final String tag) { View tabview = createTabView(mTabHost.getContext(), tag); TabSpec setContent = mTabHost.newTabSpec(tag).setIndicator(tabview).setContent(intent); mTabHost.addTab(setContent); } private static View createTabView

Android TabHost.addTab -> Null pointer exception

风格不统一 提交于 2019-12-08 15:13:26
问题 Here is my code: public class Main extends Activity { @Override public void onCreate(Bundle savedInstanceState) { TabHost tabHost = new TabHost(this); TabHost.TabSpec tab = tabHost.newTabSpec("tab1"); tab.setIndicator("Tab 1"); tab.setContent(new TabHost.TabContentFactory() { @Override public View createTabContent(String tag) { TextView tv = new TextView(Main.this); tv.setText("tab 1 content"); return tv; } }); tabHost.addTab(tab); setContentView(tabHost); } } I get this error: [...] 07-13 20

FragmentTabHost not creating view inside Fragment in android

与世无争的帅哥 提交于 2019-12-08 14:37:53
问题 I am having an issue getting the view to change on a tabhost - when I select a tab the content stays blank. From what I can tell, onCreateView is not being called on the child Fragments . onMenuCreate runs fine because the menu changes like it is supposed to. public class PatientTabFragment extends Fragment { private FragmentTabHost mTabHost; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mTabHost = new FragmentTabHost(getActivity

Creating an Android app using TabHost and multiple fragments

时间秒杀一切 提交于 2019-12-08 12:41:55
问题 I have been trying to create a basic Android app that contains tabs, which when clicked will load a new fragment - each fragment being a separate xml file. I would like to use TabHost and not the Activity Bar tabs. I have been looking through many tutorials on the web and posts here on stackoverflow, but to no avail. Most questions and tutorials are discussing either fragments OR tabs, but not both subjects. Thank you in advance for the suggestions. I would like to try a very basic app that

Using Bundle and Intent with TabHost

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 12:22:38
问题 I am using TabHost with 3 tabs. I need to pass the params selected from one screen using Bundle and / or Intent to the next and then set the correct tab in TabHost and pass those params to the correct tab. I hope that makes sense. I have a config screen that has several radio buttons that are grouped and 1 checkbox and a button. in my onClick() I have the following code. public class Distribute extends Activity implements OnClickListener { DistributionMap gixnav; protected void onCreate