You can add this line above your current code snippet:
String data=userInput.getEditableText().toString();
Here userInput is the identifier of the EditText tag in the XML file.
And just change the source line of your code to:
Toast.makeText(getApplicationContext(), "You entered "+data, Toast.LENGTH_LONG).show();
source share