I am trying to pass this variable as a parameter for a http call to my php file that inserts it into a database. If I create strings and manually set it, everything works. But when I try to use user input my app crashes. I am thinking I am having trouble storing user input from EditText into a string variable in c#. I read in java people use .getText().toString() but c# doesnt have getText(). I have tried this:
EditText usernameText = FindViewById<EditText>(Resource.Id.editUsername);
string username = usernameText.Text;
I have also tried:
string username = usernameText.toString();
<EditText
android:id="@+id/edittext"
android:layout_width="match_parent"
android:imeOptions="actionGo"
android:inputType="text"
android:layout_height="wrap_content" />
Now in c# you should do something like this
string str = edittext.text;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.