Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6097489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:02:58+00:00 2026-05-23T13:02:58+00:00

I started with the TabLayout tutorial from here . I created a ListActivity class

  • 0

I started with the TabLayout tutorial from here.

I created a ListActivity class (ListAct) to be used as a Tab. The only difference between the Tabs is the used Layout:
in the onCreate I use setContentView(R.layout.layout0) for the first Tab.
In the second I do setContentView(R.layout.layout1).
It seams a bit like a waste to use a different class for this, does it not?

Is there a way to pass the used Layout (int) while creating the Tab like this?

intent = new Intent().setClass(this, ListAct.class);
spec = tabHost.newTabSpec("list0").setIndicator("List0",res.getDrawable(R.drawable.ic_tab_artists));
spec.setContent(intent);
tabHost.addTab(spec);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:02:58+00:00Added an answer on May 23, 2026 at 1:02 pm

    Different class is useful to create as the each tab can be used to trigger activities so each activity can be given to a specific tab.
    a different file is helpful in keeping clarity in the code.
    just imagine you have to look at the same project after months and you will have a tough time figuring things out.
    so the proper way of implementing tabs is using a different file and activity for each tab you create .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I started a Rails project recently and decided to use RESTful controllers. I created
started a visual studio 2010 database project . however i am only able to
Originally started here: Django IN query as a string result - invalid literal for
I started to use the new ConcurrentDictionary from .Net4 to implement a simple caching
Started playing with grails and I want to evaluate GORM, so I created a
Started looking at the win32 API on this site: http://www.winprog.org/tutorial/start.html I've literally just compiled
Started building an application here. client and server style architecture sending active resources across
Started a new project from scratch, converted to JPA, my persistence provider is EclipseLink,
Just started converting to MVC from classic ASP and wondering about best practice for
I started using Hibernate only recently. While I was playing with it, I experienced

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.