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 8207187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:55:11+00:00 2026-06-07T08:55:11+00:00

I am trying to create a small Android App. The app will have four

  • 0

I am trying to create a small Android App. The app will have four modes. The top part of the display will contain four buttons to switch between these modes, and this part of the display will not change. The rest of the display will change depending which button has been clicked on. It will contain a table with TextViews or images.

My questions are:

  • Is it possible to create the table layout programmatically?

  • How should I approach switching between modes:-

    1. Four separate Activity classes?
    2. One Activity and programmatically change the bottom part of it?
    3. Should I create one base Activity with buttons and extend it?

What would be the best option?

  • 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-06-07T08:55:12+00:00Added an answer on June 7, 2026 at 8:55 am

    Create layout by code is not the good solution. If your table layout is simple, I think it’s not a big problem.

    Here is a simple code how to create a layout by code :

     public void onCreate(Bundle savedInstanceState){
                super.onCreate(savedInstanceState);
                    LinearLayout layout = new LinearLayout(this);
                    layout.addView(new TextView(this));
                setContentView(layout);
        }
    

    And as you see, it looks ugly !

    Hope this help 🙂

    @: Edit for additional question about Relative Layout:

    In RelativeLayout (and some Layout of android), there is an object LayoutParamsto determine some properties of sub-layout (TextView, Button… is called sub-layout too if you put in other Layout)

    Here is an example :

    RelativeLayout layout = new RelativeLayout(this);
    TextView textView = new TextView(this);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT);
    params.addRule(RelativeLayout.BELOW, textView.getId());
    
    layout.addView(textView, params);
    

    You should notice BELOW, it is one of many int constant such as Right_of…. You can see on Android Document about these.

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

Sidebar

Related Questions

I am trying to create a small web app that will allow users to
I am a novice in android and trying to create a small app. my
I am trying to create a small Android app with reasonably simple AR functionality
I have a small program that I'm trying to create to get ip addresses
I have a small assignment in C. I am trying to create an array
I'm trying to create a small web app that is used to remove items
I am trying to create a small pop-up in my Android application to let
I am trying to create a small server type application and have a question
I am crashing trying to launch a sub-activity. I have a small app to
I have a small (200kb) mp3 in the res/raw folder of my android app.

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.