如何将 EditText 的内容保存到 String 中?安卓 [英] How to save the content of a EditText into a String? Android
本文介绍了如何将 EditText 的内容保存到 String 中?安卓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经尝试过:
EditText edText1 = (EditText) findViewById(R.id.editText1);
String str = edText1.getText().toString();
我只得到数字而不是字符.如何获取 EditText 文本以便将其放在字符串上并对其进行操作?
I only get numbers but not characters. How can I get the EditText text in order to put it on a string and manipulate it?
推荐答案
// first set the Input type of the EditText in the Java class like this;
EditText edText1 = (EditText) findViewById(R.id.editText1);
edText1.setInputType(InputType.TYPE_CLASS_TEXT);
String str = edText1.getText().toString();
这篇关于如何将 EditText 的内容保存到 String 中?安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文