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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:59:11+00:00 2026-05-26T18:59:11+00:00

I have two button and want to change layout content on click button on

  • 0

I have two button and want to change layout content on click button on same page button is on the top.

I want to change particular area content in this xml by clicking on button.

It works like switch between two page.

Thanks In advance

It shows this exception in logcat

        **11-15 10:06:02.988: ERROR/AndroidRuntime(261): Uncaught handler: thread main            exiting due to uncaught exception
      11-15 10:06:03.017: ERROR/AndroidRuntime(261): java.lang.StackOverflowError
      11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.graphics.Paint.measureText(Paint.java:1020)
      11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.graphics.Paint.measureText(Paint.java:1057)
      11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.text.Styled.foreach(Styled.java:220)
      11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.text.Styled.measureText(Styled.java:371)
      11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.text.Layout.measureText(Layout.java:1601)
        11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.text.Layout.getLineMax(Layout.java:655)
       11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.text.Layout.draw(Layout.java:311)
      11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.text.BoringLayout.draw(BoringLayout.java:356)
      11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.widget.TextView.onDraw(TextView.java:4032)
      11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.widget.CompoundButton.onDraw(CompoundButton.java:229)
      11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.View.draw(View.java:6274)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.drawChild(ViewGroup.java:1526)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.drawChild(ViewGroup.java:1524)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.drawChild(ViewGroup.java:1524)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.drawChild(ViewGroup.java:1524)
    11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.drawChild(ViewGroup.java:1524)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.View.draw(View.java:6277)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.drawChild(ViewGroup.java:1526)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.drawChild(ViewGroup.java:1524)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.drawChild(ViewGroup.java:1524)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
    11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.drawChild(ViewGroup.java:1524)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.drawChild(ViewGroup.java:1524)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256)
     11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.View.draw(View.java:6277)
  11-15 10:06:03.017: ERROR/AndroidRuntime(261):     at android.view.ViewGroup.drawChild(ViewGroup.java:1526)**
  • 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-26T18:59:12+00:00Added an answer on May 26, 2026 at 6:59 pm

    You need a container in your layout – lets say its a LinearLayout. Then you need a reference to it, in your activity.

    LinearLayout container = (LinearLayout) findViewById( R.id.myContainer );
    

    Then you need to create a onClickListener for your button:

    private class OnButtonClicked implements OnClickListener {
       private void onClick( View v ) {
          //First we remove what is in the container
          container.removeAllViews();
    
          //Then we add the new content
          container.addView( newContent );
       }
    }
    

    The newContent can be any view that you inflate using a LayoutInflater.

    Remember to add the OnClickListener:

    myButton.setOnClickListener( new OnButtonClicked() );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables on a webform. On a button click I want to
I have two classes. First class has TabPage control. I want to change layout
I have two button in my program( figure A ), I want to change
I have two buttons with the same ID: <button type=submit onclick=//do something id=theID>button 1</button>
I have two quick button questions in VS. First, I want to create a
This is my code. So when button is clicked, I have two edit text
Everybody.. How to set animation on button click ? I have two buttons, both
I have a page with some clickable <div> elements, and I want to change
I have two buttons 'btnPrev' and 'btnNext' What I want to do is to
I want the next and prev buttons to have two uses. First: the standard

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.