Getting custom result from Activity???

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

  1. TobiTobsen

    TobiTobsen New Member
    5

    Jul 1, 2010
    3
    0
    5
    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
     

    Advertisement
  2. blundell

    blundell Well-Known Member
    38

    Apr 23, 2010
    125
    17
    38
    Software Engineer
    UK
    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 New Member
    5

    Jul 1, 2010
    3
    0
    5
    Hey,
    thanks a lot blundell, it works!

    Thank you!
     

Share This Page

Loading...