For the weather app I am building, I have two EditText fields.. one that prompts for latitude, and another for longitude. I have the following XML code:
As you can see, I have numberDecimal as the input type(because a proper latitude and longitude will need a '.' somewhere within the range of numbers) and imeOptions is set to ActionSend so the value is stored when the user enters their data and presses 'send' using the soft keyboard.
I am confused, though, on how to put the user input into a variable that I can use elsewhere in the app(I need it for appending it to a request to my weather API). I know that it will need to be stored in a double, but how do I exactly do that? If someone could tell me the proper code to put into the java file, and exactly where in the java file, I would greatly appreciate it. I will need to use those two values in a different activity, if that makes a difference.
Thank you guys! Have a great week!
Java:
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:imeOptions="actionSend"
android:ems="10"
android:id="@+id/latInput"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="182dp"
android:text="Please enter latitude"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:imeOptions="actionSend"
android:ems="10"
android:id="@+id/longInput"
android:layout_below="@+id/latInput"
android:layout_centerHorizontal="true"
android:layout_marginTop="85dp"
android:text="Please enter longitude"/>
As you can see, I have numberDecimal as the input type(because a proper latitude and longitude will need a '.' somewhere within the range of numbers) and imeOptions is set to ActionSend so the value is stored when the user enters their data and presses 'send' using the soft keyboard.
I am confused, though, on how to put the user input into a variable that I can use elsewhere in the app(I need it for appending it to a request to my weather API). I know that it will need to be stored in a double, but how do I exactly do that? If someone could tell me the proper code to put into the java file, and exactly where in the java file, I would greatly appreciate it. I will need to use those two values in a different activity, if that makes a difference.
Thank you guys! Have a great week!

I just hope the 'actionSend' attribute of my latInput and longInput will actually hold the input content without any added code. The documentation on that wasn't clear.