I am doing a registration page for my application.For this I need to insert the registration details in to sqlite DB.Once the registration is done,the edittext fields should display those details fetching it from database and the submit button and text fields should be disabled to stop from a second time registration.Can anyone suggest the suitable way?
You can write/read into database easily: read this for more details: http://developer.android.com/guide/topics/data/data-storage.html#db
and this
http://mobile.tutsplus.com/tutorials/android/android-sqlite/
To get data from edit text, you can do this: myEditText.getText().toString()
Check code for database in the following link Android SQLite
You have to store the value in an arraylist and which is retrieved from database and set the value to the edit text as
// myarraylist is the arraylist which contains
// the data retrieved from database
editText.setText(myarraylist.get(0));
After the data is retrieved, you have to check the condition whether editText.getText().toString() length is greater then zero you should not allow them to edit the text in editText by using following
editText.setFocusable(false);
Related
enter image description here
I would like to retrieve the information to save,
- Listview
- TextFieldForm
First make a data structure to hold the contact data. Then provide an onSaved function to each TextFormField that saves the value to the data structure.
I am reading database values from MySQL on web in the form of ClickAble List.Show only one column value like "name".Now I want to read all values related to specific name like when Click on one name show all values related to that person.now I don't know how to get name from list and send to database and then read data only related to that particular name. Still don't try any code.....
in my application,there are three screen..in first window(MainActivity) one button is here..when i click the button new window is open,there is edittext for user value..and also refresh button on second scrren ..
after entering value into edittext and refresh button the value are stored into database.my problem is that how to fetch them and display on new table layout in new window..
first screen
second screen
you may use button or any event to fetch the value from the database. you can run query on the database and store the value in the cursor. as far as code is concerned for fetching the value from the database you may http://www.vogella.com/tutorials/AndroidSQLite/article.html or http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html or http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/
I currently have a layout with an EditText field, Datepicker, and a button. I'm trying to find a code that would make it so when the button is pressed, the values of the datepicker and edittext are stored in a SQL file so that it may be retrieved later.
I'm fairly new to using the SQLite functionality on android, and couldn't find a solution to this myself. Thanks!
Firstly read documentation regarding SQLite database from
http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html
http://www.vogella.de/articles/AndroidSQLite/article.html#overview_sqlite
To store value on click of button follow the steps.
Create DbHelper class extends SQLiteOpenHelper in which you can create table for required values to store in database for e.g. db.execSQL("create table "+EXAMPLE_TABLE+" ("+EDIT+" text, "+DATE+" text )");
Create a class ExampleProvider extends ContentProvider which manages queries like insert, query(select) , delete and update.
After that on click on button retrieve the values from edit text and datepicker , then store it into one object and then using resolver fire the insert query.
Check out from commandline whether values inserted into db or not.
Similarly you can retrieve values from your databases using query() method which retrieve data in form of cursor .
I am a new developer on Android and I want store user data in database using sqlite. For that design .xml file username as edittext and take button, after fill all text fields when click the button all the data is stored in database. and show this data on screen.....
These are useful tutorial and will help you
http://www.anotherandroidblog.com/2010/08/04/android-database-tutorial/
http://www.higherpass.com/Android/Tutorials/Accessing-Data-With-Android-Cursors/1/
http://developer.android.com/resources/tutorials/notepad/index.html