简体   繁体   English

如何在android中键入编辑文本框的操作?

[英]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.

相关问题 如何从 android java 中的警报框中获取文本视图中的编辑文本值? - How do I get the edit text value in text view from an alert box in android java? 如何在 android 的编辑文本中插入多个图像 - How do I insert multiple image in Edit Text in android 如何让软键盘不直接推送到编辑文本,而是推送到编辑文本下方的特定位置? (安卓) - How do I make the soft keyboard push not directly to the Edit Text, but to a specific place below the Edit Text? (Android) 如何将变量设置为“编辑文本框” - How do you set a variable to an Edit Text Box Android-编辑动作栏按钮文字 - Android - Edit Action Bar Button text Android Studio:如何从活动获取用户输入(从微调器和编辑文本)到另一个活动? - Android Studio: How do I get user input (From Spinner and Edit Text) from activity to another activity? 如何在Android中创建一个框来保存Google地图下方的文本? - How do I create a box to hold text below Google maps within android? Android上的“&lt;”键在一个编辑文本上关闭监听器? - Android on “<” key up listener on an edit text? 从编辑文本框Android中删除默认文本 - Remove default text from edit text box Android 当“编辑文本”框中没有文本时,如何使按钮不可单击? - How can I make a button unclickable when there is no text in the Edit Text box?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM