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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:55:29+00:00 2026-06-15T08:55:29+00:00

i call this method SolveUpdation (from button- onclickAction Listener) from mainAcitivity with main layout.

  • 0

i call this method SolveUpdation (from button- onclickAction Listener) from mainAcitivity with main layout. i use other layout to get value from user and set it as button title in the main layout and that is only instruction that does not works for me

    private void  SolveUpdation() {     //this function call is generated from the main Activity with main layout       
        setContentView(R.layout.updateappliance); //this is 2nd layout to get values from user and use them as buttonText in the main layout   

        btnSaveApp = (Button) findViewById(R.id.Bupdatenow);
        btnSaveApp.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {       
                // TODO Auto-generated method stub
                  mOutEditText = (EditText) findViewById(R.id.edit_text_1);               
                  TextView view1 = (TextView) findViewById(R.id.edit_text_1);
                  final String TitleApp1 = view1.getText().toString();  //the value is read properly here

//                if (App1.length() > 0) {
//                    byte[] send = App1.getBytes();
//                }

                btnSaveApp.setText(TitleApp1); //this works fine
                startActivity(new Intent(HomeScreen.this, HomeScreen.class));//this the main activity for main layout
                setContentView(R.layout.main); //this is the main layout and this instruction works
                buttonLED1.setText(TitleApp1); //buttonLED1 (a Togglebutton or can be simple) is  defined in main layout and this does not works and this is what i am stuck with
                SaveAppNamesToast(TitleApp1);   //this is just to toast the value and it works fine.
            }});

So plz can any one guide me why this instruction buttonLED1.setText(TitleApp1); does not works ??? Any help will be appreciatable.. thanks

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

    No offense, but the way you write your code is not a good practice.
    My advise: Stop calling another setContentView in your Main Activity. You should rather implement all needed Buttons and EditTexts in one layout and set their visiblity to gone or visible depending on which button was clicked.

    If you don’t wanna do this you should create a second class that handles the input of the user. After pressing the save button you initialize your intent for the main activity and give it via intent.putExtra("KEY", value) the input of the user.
    Your Main Activity can receive this value via getIntent().getExtras().getInt("KEY").

    By the way: I think your current code doesn’t work because of the new Activity you start. Through this everything gets initialized again so the buttonLED1 that you see isn’t the same buttonLED1 that gets the text.

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

Sidebar

Related Questions

I tried to call this method from multiple threads trying to get the ID
click the button to call this method: private void goRegister(final boolean isUsername) { new
Shouldn't I be able to call this CoffeeScript method from within an erb template?
I have this method call I have to use... financial_document.assets.length But financial_document.assets could be
I always get responce NULL when call this method but in case if suppose
I'm trying to call this method from a music-rendering function that is run in
Say I have a function in JS function playerJob(job){} I call this method from
I've got a Method: FillListBox(); I call this method from different places.. But sometimes
I get the errror: java.lang.NullPointerException: println needs a message when I call this method:
How do i call this method from java : WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,

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.