Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Rahsan Boykin2,067 Points
User Data Inputs
I am new to Android and I am creating a simple app that takes User data (through a editor view and a Boolean check box). I want to save the data to an sql database (not shared pref or internal storage). I've got help creating the database but what I'm missing is the technique for capturing the user input and inserting that data into the database....any thoughts. (I know how to input the data if it were captured in an XML document)...I'm talking about the actual text inputted by the user through the activity display XML file (and view)
Ben JakubenTreehouse Teacher
Hi Rahsan! Sounds like you'll want an EditText field for input (which we'll cover in the upcoming Self-Destructing App project). Put the EditText in your layout file and get it in your Activity's onCreate() method like normal, and then you can get the value that the user typed like this:
String userInput = mEditText.getText().toString();
toString() call is important!)
For the check, you'll want the CheckBox view, and to get its value you do the following:
boolean isChecked = mCheckBox.isChecked();
Hope this helps - stop back if you need further information!