Getting custom result from Activity???


Last Updated:

  1. TobiTobsen

    TobiTobsen New Member This Topic's Starter

    Joined:
    Jul 1, 2010
    Messages:
    3
    Likes Received:
    0
    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

    Joined:
    Apr 23, 2010
    Messages:
    125
    Likes Received:
    17
    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 This Topic's Starter

    Joined:
    Jul 1, 2010
    Messages:
    3
    Likes Received:
    0
    Hey,
    thanks a lot blundell, it works!

    Thank you!
     

Share This Page

Loading...