I know something similar has already been asked, but I'm having some trouble to get a decimal number that come from keyboard.
My Java code in the onCreate method should be:
textS0 = (EditText)findViewById(R.id.editS0);
Button btn_S0 = (Button)findViewById(R.id.getS0);
btn_S0.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
//how should I get here the number from keyboard?
//I think I should be something like
//double S0=textS0.getText()....
}
});
And that's what my XML file contains
<EditText
android:id="@+id/editS0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/S0"
android:inputType="numberDecimal" />
<Button
android:id="@+id/getS0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/setS0" />
</LinearLayout>