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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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);
回答2:
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()