-2

I'm android Problems to convert a full name of a android.widget.EditText@410e5a58 edittextview is the string representation of your EditText object (ie , calling the toString your EditText object will return this string) I know it's simple but , as I followed here Tips site and not getting hit.

coding page1 send to page2

TextView codigo1  = (TextView)findViewById(R.id.textView1);
TextView codigo2  = (TextView)findViewById(R.id.textView2);
Intent intent = new Intent(this, MainActivity.class);
intent.putExtra("codigo1",""+codigo1 );
intent.putExtra("codigo2",""+codigo2 );
startActivity(intent);

XML page1

<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number" >


<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Código Monitorado:"
android:textAppearance="?android:attr/textAppearanceLarge" />

coding page2 recive

 setContentView(R.layout.main);
    String codigo1 = getIntent().getStringExtra("codigo1");
    String codigo2 = getIntent().getStringExtra("codigo2");

    TextView codMonitorTV    = (TextView)findViewById(R.id.textViewCod1);
    TextView codMonitoradoTV = (TextView)findViewById(R.id.textViewCod2);

    codMonitorTV.setText(codigomonitor);
    codMonitoradoTV.setText(codigomonitorado);

XML page2

<TextView
        android:id="@+id/textViewCodMonitor"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/retrieve_location_button"
        android:textAppearance="?android:attr/textAppearanceSmall" />

    <TextView
        android:id="@+id/textViewCodMonitorado"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textViewCodMonitor"
        android:layout_toRightOf="@+id/retrieve_location_button"
        android:textAppearance="?android:attr/textAppearanceSmall" />

I type in 1234 and get android.widget.EditText@410e5a58

1 Answers1

1

You need to call editText.getText().toString() to get the text input.

Also it's good to know: http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#toString%28%29

public String toString() Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())

Returns: a string representation of the object.

Farshad
  • 3,074
  • 2
  • 30
  • 44
Diego Malone
  • 1,044
  • 9
  • 25