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

Discussion in 'Application Development' started by kiranuday43, Mar 9, 2010.

  1. kiranuday43

    kiranuday43 Member
    15

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

    Advertisement
  2. jon21569

    jon21569 Member
    16

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

    tranzolic New Member
    5

    Jun 30, 2010
    1
    0
    5
    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
    43

    Apr 30, 2010
    375
    35
    43
    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...