Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@ at the beginning of EditText value

When I tried to hard code a string starts with @ as the value for android:text attribute, eclipse says

error: Error: No resource type specified (at 'text' with value '@dmin123').

how can I avoid this?

<EditText android:id="@+id/password_input" 
    android:layout_width="fill_parent" android:layout_height="wrap_content"
    android:singleLine="true" android:fadingEdge="horizontal"
    android:password="true" android:text="@dmin123"/>
like image 909
Mithun Sreedharan Avatar asked Jan 06 '12 04:01

Mithun Sreedharan


3 Answers

Try this to show @ in your edit text :

android:text="\@dmin123"

like image 52
Sourab Sharma Avatar answered Oct 29 '22 21:10

Sourab Sharma


You need to escape @ symbol. try this: android:text="\@dmin123"

like image 30
kosa Avatar answered Oct 29 '22 23:10

kosa


Please try this,

android:text="\@dmin123"/>

you need to add forward '/' before the '@' character. Just like Escape Sequence in C Language. I have tried it in my code & it is working fine. Showing me Command with @ in text.

like image 45
Lucifer Avatar answered Oct 29 '22 21:10

Lucifer