[英]How do I key in an action of a edit text box in android?
Based on the following main.xml code (snippet below), how do I get the java code in the class to save the data that the user types in?? 基于以下main.xml代码(下面的代码段),如何在类中获取Java代码以保存用户键入的数据?
<TextView
android:id="@+id/textview1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="year of car" />
<EditText
android:id="@+id/myeditfield"
android:layout_width="100px"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/textview1_1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="make of car" />
<EditText
android:id="@+id/myeditfield"
android:layout_width="200px"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/textview1_2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="model of car" />
<EditText
android:id="@+id/myeditfield"
android:layout_width="200px"
android:layout_height="wrap_content" />
Thanks!! 谢谢!!
ironmantis7x Ironmantis7x
TextView tv = (TextView)findViewById(R.id.textview1_2);
String txt =tv.getText().toString();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.