How to put default value in EditText in Android Studio -


i trying put value in edittext can not.

the code edit:

<edittext android:textcolor="@color/white" android:id="@id/input_username"      android:layout_width="wrap_content" android:layout_height="wrap_content"      android:layout_margintop="20.0dip" android:hint="@string/input_username_hint"      android:ems="10" android:singleline="true" android:maxlength="140"      android:layout_below="@id/input_room_name" android:layout_centerhorizontal="true" /> 

when put android:text="user" genarated apk not opening.

do this:

edittext.settext("your default text"); 

but if want show gray text disappears when user starts type, you're looking android:hint.

on xml:

android:hint="your default text" 

on java:

edittext.sethint("your default text"); 

Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -