48132

How to start an activity in a tab?

I am using tabs in my application.

I have 3 tabs : home, services, contact us.

In the 'home tab', there is 'login button' and my requirement is when I click the login button, it should display the view for 'login' in the same tab itself. That means it should start another activity (login.class) and display corresponding view (login.xml). And the tabs should be displayed at the top as before.

But when I click the login button, it should start login activity, but the tabs are disappeared.

How can I start an activity in the same tab itself?

Answer1:

In that case you may need to use ActivityGroup (it's pain in the ass I have to say):

Use Android ActivityGroup within TabHost to show different Activity

There are more examples about it, just Google them.

Answer2:

I have no experience with the TabHost, because I didn't used it by now, but what I found could be interesting for you:

http://developer.android.com/resources/tutorials/views/hello-tabwidget.html

There they are using

spec = tabHost.newTabSpec("albums").setIndicator("Albums", res.getDrawable(R.drawable.ic_tab_albums)) .setContent(intent);

So what you can use is calling an Intent on an existing Activity when user logged in and use

public TabHost.TabSpec setContent (Intent intent)

This sounds feasible to to me.

Recommend

  • ffmpeg drawtext filter with zoom in effect
  • Changing Jquery FlexGrid's data
  • Is it possible to start activityB inside activityA? And how?
  • AppDomain doesn't make shadow files
  • Uploading SSL certificates TO IAM
  • Lifetime of RDF nodes in Redland RDF after parsing a model?
  • Twiiter Bootstrap (Button Dropdown) + Div Fixed
  • JButton background images
  • What is the purpose of /usr/lib/vendor_ruby
  • How do I get the data from a finished `NSURLSessionDataTask`?
  • named parameters in sp_executesql
  • Installing Flash Player on an Android Emulator
  • How can I keep open the command prompt in my windows form application in c++?
  • css background images not always displayed
  • You tube videos are not playing
  • SAVE attribute needed for Fortran variables when only the C_LOC address is returned to a C program?
  • Android Google Maps API v2 start navigation
  • Insert new calendar with SyncAdapter- Calendar API Android
  • How can I enlarge video fullscreen without the affected interface project in as3?
  • AJAX Html Editor Extender upload image appearing blank
  • Play WS (2.2.1): post/put large request
  • Change multiple background-images with jQuery
  • Algorithm for a smudge tool?
  • Seeking advice on Jetty HttpClient Hang
  • Can Jackson SerializationFeature be overridden per field or class?
  • Window Size for Mac application
  • Deserializing XML into class C#
  • Javascript + PHP Encryption with pidCrypt
  • How to make Safari send if-modified-since header?
  • Google cloud sdk not working when python points python3
  • How to pass list parameters for each object using Spring MVC?
  • Is there a mandatory requirement to switch app.yaml?
  • Android Studio and gradle
  • using HTMLImports.whenReady not working in chrome
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • Qt: Run a script BEFORE make
  • JaxB to read class hierarchy
  • How to Embed XSL into XML
  • Android Heatmap on canvas or ImageView
  • Conditional In-Line CSS for IE and Others?