android-tabhost

TabHost inside a ScrollView forces it it to scroll to the bottom

ⅰ亾dé卋堺 提交于 2019-12-02 02:52:19
My question is very similar to this unanswered one, with some small differences that I will explain: TabHost inside of a Scrollview: always scrolls down when a Tab is clicked My ScrollView initiates scrolled to the bottom, showing the TabHost content instead of the ones on top of it (you can see the screenshots in the linked question, it's very similar). If I manually scroll up, clicking in different tabs doesn't affect the ScrollView, the problem is only in the first time it's shown. This is the difference between the other question. Things I tried with no success: Make the top components

Issue with displaying TabHost Layout in new Intent

我们两清 提交于 2019-12-02 00:58:37
问题 I am having an issue with using TabHost in a new Intent of type TabActivity which I hope you can point me in the right direction. Funnily it works fine when I try to view it in the original Intent : setContentView(R.layout.main) I get a "forced closed" and within logcat, I get the following error even though my Tabhost id = "@android:id/tabhost": 02-18 22:23:11.937: ERROR/AndroidRuntime(5944): Caused by: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is

ServiceConnection.onServiceConnected() never called after binding to started service

喜欢而已 提交于 2019-12-01 20:19:23
In a game application I have the following scenario: From the main game Activity , the player starts several game tasks that run in the background with varying duration. The player should be able to view the progress of the running game tasks in a separate View . To do this, I created two Activity s and a Service , defined as follows: Service ProgressService handles several ProgressBar s running simultaneously on parallel threads. Activity WorkScreen2 creates a game task, starts the Service with startService() with task parameters passed in a Bundle . Activity ProgressScreen binds to the

Removing a tab and the activity (intent) inside of it from a TabHost

扶醉桌前 提交于 2019-12-01 19:24:19
I have an app that can create tabs dynamically. And when I create a tab I initiate an activity as an intent. Like so: private void addTab(Context packageContext, Class<?> newClass, TabHost mTabHost, String tabId, String tabLabel){ // newClass is my Activity class that I want to start in the tab Intent intent = new Intent().setClass(packageContext, newClass); TabHost.TabSpec spec; spec = mTabHost.newTabSpec(tabId).setIndicator(tabLabel) .setContent(intent); mTabHost.addTab(spec); mTabHost.setCurrentTabByTag(tabId); } Pretty standard. And it works great. Now, suppose that I have a button (or

Android Tab Help. How to set 2nd tab as default when app opens?

老子叫甜甜 提交于 2019-12-01 17:23:06
I have created an app with 3 tabs. The app works fine but I want the 2nd tab to be selected and loaded when the app opens. How can I set that? Here is my code : public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TabHost tabHost = getTabHost(); // Tab for Home TabSpec homespec = tabHost.newTabSpec("Home"); // setting Title and Icon for the Tab homespec.setIndicator("Home",getResources().getDrawable(R.drawable.icons_home_tab)); Intent photosIntent = new Intent(this, HomeActivity.class); homespec.setContent(photosIntent);

Android Market-like tabbar

Deadly 提交于 2019-12-01 14:57:42
What's the best way to implement an Android Market-like tabbar (Apps/Games/Downloads)? It would be great if I could use TabHost, but I believe it doesn't allow this level of customization. As Cristian said, it's definitely possible using a TabHost , and you don't even need to use the androidtabs code that he links to. As of SDK level 4 (i.e. Android 1.6) you can pass a View to TabHost.TabSpec.setIndicator() , which will allow you to completely control the look of the tabs. However, tapping either of those buttons in the Market opens up a new Activity, and as such, using simple Button s might

tabHost.setup() gives null pointer exception (Android studio)

落花浮王杯 提交于 2019-12-01 14:38:04
I have a very simple app which is just an activity with a tab view on it. I have initialised and casted everything to as it should be but am continually getting a null pointer error which always links back to tabHost.setup(); I am using android studio and am new to java. This question has been asked a lot on here but all answers just say to include the setup() and I have already done that. Here is my .java file: package com.example.app; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle;

how to pass value betweeen two tab in android

大城市里の小女人 提交于 2019-12-01 12:48:25
I have followed the tutorial for android tab host and been able to run on emulator. Now what I want to do is just implement a text box and button in one tabview. As soon as user enter in text box and press button the value entered in text box shouls pass to second tab and I can use that value for further calculations. Please guide me how to do this? Thanks, Alok. I think what you should to do is to declare a global variable: class foobarApp extends Application { private String txtValue; public String getTxtValue(){ return txtValue; } public void setTxtValue(String aString){ txtValue= aString;

how to pass value betweeen two tab in android

荒凉一梦 提交于 2019-12-01 11:18:29
问题 I have followed the tutorial for android tab host and been able to run on emulator. Now what I want to do is just implement a text box and button in one tabview. As soon as user enter in text box and press button the value entered in text box shouls pass to second tab and I can use that value for further calculations. Please guide me how to do this? Thanks, Alok. 回答1: I think what you should to do is to declare a global variable: class foobarApp extends Application { private String txtValue;

Android Tabs in middle of layout

不打扰是莪最后的温柔 提交于 2019-12-01 08:09:55
In the middle of my layout I want to have 2 tabs to choose between viewing 2 different lists in the second half of the screen. How can I do this? Here is an image illustrating what I wish to achieve. This image has a questions tab and an answers tab in the middle of the screen. Depending on which tab you select it shows a different listview: I wish to achieve this exact same thing. I tried doing it with TabHost widget, but for the life of me I couldn't get rid of the title bar (I tried selecting themes with no title bar, tried setting the theme in the manifest to a no title bar one) I also