【发布时间】:2015-12-14 23:01:09
【问题描述】:
我不确定如何解决此问题。 我有一个微调器。 When a certain choice is selected then whatever is in the text field (number) I want to use that value for a specific method.
在主要:
EditText temp;
temp = (EditText)findViewById(R.id.editText);
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
{
String choice = parent.getSelectedItem().toString();
Double value = Double.parseDouble(temp.getText().toString());
}
在我尝试将 temp 转换为 double 之前一切正常,它会使应用程序崩溃。任何帮助将不胜感激。
我是 ANDROID STUDIO 的新手。
【问题讨论】:
-
我也试过 Double value = new Double(temp.getText().toString());
标签: string text double tostring gettext