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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:37:59+00:00 2026-05-23T01:37:59+00:00

I have 3 buttons on each layout. When i clicked on button MOH in

  • 0

I have 3 buttons on each layout. When i clicked on button MOH in results.xml, MOHactivity is invoked and displayed the results_health layout. But when i wanted to click any button in results_health, it is like the screen has frozen. But, if i clicked on BACK button, it will go back to my main activity. I have no idea how to play around with this. Thanks.

ResultsActivity.java is same for Result_PDRM.java & Result_MOH.java(oncreate())

       ImageView myMOHButton = (ImageView) findViewById(R.id.MOH_Button);  
        myMOHButton.setOnClickListener(new View.OnClickListener() {  
            public void onClick(View v)
            {  
                setContentView(R.layout.results_health);

            }  
        }); 

        ImageView myPDRMButton = (ImageView) findViewById(R.id.PDRM_Button);  
        myPDRMButton.setOnClickListener(new View.OnClickListener() {  
            public void onClick(View v)
            {  
                setContentView(R.layout.results_pdrm);
            }  
        }); 

        ImageView myMainButton = (ImageView) findViewById(R.id.Main_Button);  
        myMainButton.setOnClickListener(new View.OnClickListener() {  
            public void onClick(View v)
            {  
                setContentView(R.layout.main);

            }
        }
        ); 

result.xml is also same with results_health.xml & result_pdrm.xml (results_health don’t have MOH ImageView, results_pdrm don’t have PDRM ImageView)

        <?xml version="1.0" encoding="utf-8"?>
        <AbsoluteLayout
         android:id="@+id/widget56"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         xmlns:android="http://schemas.android.com/apk/res/android"
          android:background="@drawable/bgnd">
        <TextView android:id="@+id/MOH" android:textStyle="bold" android:textColor="#ff00ff00" android:text="Health Details" android:layout_width="wrap_content" android:textSize="25sp" android:layout_height="wrap_content" android:layout_x="6dip" android:layout_y="9dip"></TextView>
        <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@id/JPJ_Button" android:src="@drawable/jpj1" android:layout_y="425dip" android:layout_x="2dip"></ImageView>
        <ImageView android:layout_width="wrap_content" android:id="@id/PDRM_Button" android:layout_height="wrap_content" android:src="@drawable/pdrm1" android:layout_x="94dip" android:layout_y="425dip"></ImageView>
        <ImageView android:layout_width="wrap_content" android:id="@id/JPN_Button" android:layout_height="wrap_content" android:src="@drawable/camera_48" android:layout_x="186dip" android:layout_y="425dip"></ImageView>
      <ImageView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@id/Main_Button" android:src="@drawable/camera_small" android:layout_x="277dip" android:layout_y="425dip"></ImageView>
       </AbsoluteLayout>

Please help.

  • 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-23T01:37:59+00:00Added an answer on May 23, 2026 at 1:37 am

    What you’re doing here is replacing the XML layout for the current activity. The reason it appears frozen is because you slapped a new UI over your code, but didn’t attach any ClickHandlers to the buttons because under the hood you were still running the code from the previous activiy.

    What you WANT to do is go from one activity to another. To go to another activity, you need to declare an intent.

    ImageView myMainButton = (ImageView) findViewById(R.id.Main_Button);  
            myMainButton.setOnClickListener(new View.OnClickListener() {  
                public void onClick(View v)
                {  
                        Intent i = new Intent(ResultsActivity.this, Result_PDRM.class);
                        startActivityForResult(i,0);
                }
            }
            );
    

    This will take you from ResultsActivity to Result_PDRM. Then, in onCreate in Result_PDRM, you call:

    setContentView(R.layout.results_pdrm);
    

    Make sure you have your clickHandlers in Result_PDRM wired up to the proper controls in the XML layout.

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

Sidebar

Related Questions

I have a listView, where each row has a button in the row layout.
I have two radio buttons each with a unique ID. When one is clicked,
I have 4 buttons on a page. Each button opens a modal window and
I have a big table containing a button in each cell. These buttons are
HI I have a form with a few buttons. Each button runs a few
Lets say we have a main class with 5 buttons, where when each clicked
I have various XML layouts. In all of those layouts I have buttons, but
Ok, i have two buttons in linear layout: <LinearLayout android:id=@+id/linearLayout1 android:layout_height=wrap_content android:layout_width=fill_parent> <Button android:id=@+id/aktiviraj_paket
I have ten buttons that each correspond to a different number. I'm looking to
I have two radio buttons next to each other, and even though each one

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.