How to save input from TextEdit field into a string?How do save an Android Activity state using save instance state?How to check if a string contains a substring in BashHow do I iterate over the words of a string?How do I read / convert an InputStream into a String in Java?How to check if a string “StartsWith” another string?How do I make the first letter of a string uppercase in JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I check if a string contains a specific word?How do I convert a String to an int in Java?

How do I compare the result of "1d20+x, with advantage" to "1d20+y, without advantage", assuming x < y?

Do atomic orbitals "pulse" in time?

SSD - Disk is OK, one bad sector

What's the difference between a Bunsen burner and a gas stove?

How can a Lich look like a human without magic?

What stroke width Instagram is using for its icons and how to get same results?

Is the schwa sound consistent?

How can I answer high-school writing prompts without sounding weird and fake?

Does kinetic energy warp spacetime?

What does i386 mean on macOS Mojave?

On what legal basis did the UK remove the 'European Union' from its passport?

What does "Ich wusste, dass aus dir mal was wird" mean?

Is taking modulus on both sides of an equation valid?

How to make a language evolve quickly?

Why doesn't Rocket Lab use a solid stage?

Why does my circuit work on a breadboard, but not on a perfboard? I am new to soldering

Why was the Ancient One so hesitant to teach Dr. Strange the art of sorcery?

Make all the squares explode

Would an 8% reduction in drag outweigh the weight addition from this custom CFD-tested winglet?

How can this pool heater gas line be disconnected?

What are the implications of the new alleged key recovery attack preprint on SIMON?

When a land becomes a creature, is it untapped?

Early arrival in Australia, early hotel check in not available

How to prevent cooked noodles & dumplings from getting soggy



How to save input from TextEdit field into a string?


How do save an Android Activity state using save instance state?How to check if a string contains a substring in BashHow do I iterate over the words of a string?How do I read / convert an InputStream into a String in Java?How to check if a string “StartsWith” another string?How do I make the first letter of a string uppercase in JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I check if a string contains a specific word?How do I convert a String to an int in Java?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm making a simple app, where there is one TextInput field and a button next to it.
The TextInput field loads @string/duration_time from strings.xml.
The button next to it will display a simple message ("hello" + the string duration_time). However, it will always display the original information from string duration_time.



How do I set up a TextChangedListener to update the string/duration_time to reflect the input from the user? How do I access the information from TextInput and use it? Because as in the example below, under "public void afterTextChanged" I am trying to save the information, but I don't know where it's stored.



Kind regards



button2.addTextChangedListener(new TextWatcher() 
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after)



@Override
public void onTextChanged(CharSequence s, int start, int before, int count)



@Override
public void afterTextChanged(Editable s)
String duration_input= WHAT_Do_I_Put_Here;

);









share|improve this question




























    0















    I'm making a simple app, where there is one TextInput field and a button next to it.
    The TextInput field loads @string/duration_time from strings.xml.
    The button next to it will display a simple message ("hello" + the string duration_time). However, it will always display the original information from string duration_time.



    How do I set up a TextChangedListener to update the string/duration_time to reflect the input from the user? How do I access the information from TextInput and use it? Because as in the example below, under "public void afterTextChanged" I am trying to save the information, but I don't know where it's stored.



    Kind regards



    button2.addTextChangedListener(new TextWatcher() 
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after)



    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count)



    @Override
    public void afterTextChanged(Editable s)
    String duration_input= WHAT_Do_I_Put_Here;

    );









    share|improve this question
























      0












      0








      0








      I'm making a simple app, where there is one TextInput field and a button next to it.
      The TextInput field loads @string/duration_time from strings.xml.
      The button next to it will display a simple message ("hello" + the string duration_time). However, it will always display the original information from string duration_time.



      How do I set up a TextChangedListener to update the string/duration_time to reflect the input from the user? How do I access the information from TextInput and use it? Because as in the example below, under "public void afterTextChanged" I am trying to save the information, but I don't know where it's stored.



      Kind regards



      button2.addTextChangedListener(new TextWatcher() 
      @Override
      public void beforeTextChanged(CharSequence s, int start, int count, int after)



      @Override
      public void onTextChanged(CharSequence s, int start, int before, int count)



      @Override
      public void afterTextChanged(Editable s)
      String duration_input= WHAT_Do_I_Put_Here;

      );









      share|improve this question














      I'm making a simple app, where there is one TextInput field and a button next to it.
      The TextInput field loads @string/duration_time from strings.xml.
      The button next to it will display a simple message ("hello" + the string duration_time). However, it will always display the original information from string duration_time.



      How do I set up a TextChangedListener to update the string/duration_time to reflect the input from the user? How do I access the information from TextInput and use it? Because as in the example below, under "public void afterTextChanged" I am trying to save the information, but I don't know where it's stored.



      Kind regards



      button2.addTextChangedListener(new TextWatcher() 
      @Override
      public void beforeTextChanged(CharSequence s, int start, int count, int after)



      @Override
      public void onTextChanged(CharSequence s, int start, int before, int count)



      @Override
      public void afterTextChanged(Editable s)
      String duration_input= WHAT_Do_I_Put_Here;

      );






      android string addtextchangedlistener






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 23 at 12:09









      TasmotanizerTasmotanizer

      62




      62






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Suppose you are using editText and button as Android Wigets.
          Now if you want to get the the text inside editText on click of button.It can be done like this



          String textEdit = "";
          button.setOnClickListener(->view
          textEdit = editText.getText().toString();
          );


          Now your textEdit will contain the text which you entered in your editText.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55313579%2fhow-to-save-input-from-textedit-field-into-a-string%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Suppose you are using editText and button as Android Wigets.
            Now if you want to get the the text inside editText on click of button.It can be done like this



            String textEdit = "";
            button.setOnClickListener(->view
            textEdit = editText.getText().toString();
            );


            Now your textEdit will contain the text which you entered in your editText.






            share|improve this answer



























              0














              Suppose you are using editText and button as Android Wigets.
              Now if you want to get the the text inside editText on click of button.It can be done like this



              String textEdit = "";
              button.setOnClickListener(->view
              textEdit = editText.getText().toString();
              );


              Now your textEdit will contain the text which you entered in your editText.






              share|improve this answer

























                0












                0








                0







                Suppose you are using editText and button as Android Wigets.
                Now if you want to get the the text inside editText on click of button.It can be done like this



                String textEdit = "";
                button.setOnClickListener(->view
                textEdit = editText.getText().toString();
                );


                Now your textEdit will contain the text which you entered in your editText.






                share|improve this answer













                Suppose you are using editText and button as Android Wigets.
                Now if you want to get the the text inside editText on click of button.It can be done like this



                String textEdit = "";
                button.setOnClickListener(->view
                textEdit = editText.getText().toString();
                );


                Now your textEdit will contain the text which you entered in your editText.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 23 at 12:17









                Ajay ChauhanAjay Chauhan

                267217




                267217





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55313579%2fhow-to-save-input-from-textedit-field-into-a-string%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript