1. Are you ready for the Galaxy S20? Here is everything we know so far!

Getting custom result from Activity???

Discussion in 'Android Development' started by TobiTobsen, Aug 9, 2010.

  1. TobiTobsen

    TobiTobsen Lurker
    Thread Starter

    Hello,
    I'm trying to develop an easy app.
    By pressing the Menu button I can open a small menu with two EditText fields and one Button.
    The user has to enter data in the fields, presses the ok button and goes back to the main activity.
    This is all working, but I did not find a way to receive the data of the two text fields...
    I found this
    Common Tasks and How to Do Them in Android | Android Developers
    But sadly I did not help me with my last problem...

    I think its easy if you know how to... So please let my know :).

    Cheers,
    Tobi
     


  2. blundell

    blundell Well-Known Member

    Hi

    You can use putExtra

    Intent.putExtra

    to add primitive types to your Intent

    so you would have something like:

    Code (Text):
    1.  
    2. intent.putExtra("textViewOne" textView.getText());
    3.  
    Then back on your main menu you would use
    Code (Text):
    1.  
    2. String value = getExtra("textViewOne", "defaultIfFail");
    3.  
     
    TobiTobsen likes this.
  3. TobiTobsen

    TobiTobsen Lurker
    Thread Starter

    Hey,
    thanks a lot blundell, it works!

    Thank you!
     
Loading...

Share This Page

Loading...