Anybody tel me,,how to convert editable text to string


Last Updated:

  1. kiranuday43

    kiranuday43 Member This Topic's Starter

    Joined:
    Mar 3, 2010
    Messages:
    20
    Likes Received:
    0
    I wanna get the text from edittext as string,,,how to get that..:(
     

    Advertisement
  2. jon21569

    jon21569 Member

    Joined:
    Aug 10, 2008
    Messages:
    23
    Likes Received:
    7
    final EditText text = (EditText)findViewById(R.id.text);
    System.out.println( "The String: " + text.getText().toString() );
     
  3. tranzolic

    tranzolic New Member

    Joined:
    Jun 30, 2010
    Messages:
    1
    Likes Received:
    0
    i always get a message saying "id cannot be resolved"

    my code is as follows:
    txtbox1= (EditText) findViewById(R.id.txtbox1);
    button1 = (Button) findViewById(R.id.button1);
    tv = (TextView) findViewById(R.id.tv);
    txtbox2= (EditText) findViewById(R.id.txtbox2);
     
  4. cp1

    cp1 Well-Known Member

    Joined:
    Apr 30, 2010
    Messages:
    375
    Likes Received:
    35
    Post your xml -- you're probably not creating the views correctly. You need to have something like:
    <EditText android:id="@+id/text"
    etc

    (note the + before the id)

    If you do have this, make sure your xml is saved and doesn't have any other errors in it.
     

Share This Page

Loading...