android - How can I save form data to a database on the sdcard? -


i have "customer information" form in application. need data filled in on form saved "transaction record" file saved on sd card. master list of transactions app has completed. how can save data growing record?

below example of form.

name: sue license: d1234567890 address: 742 evergreen terrace state: xy phone: 111-222-3344 

i need save in kind of growing database...

| transaction  | name    | license        | address                | state | phone --------------------------------------------------------------------------------------- | 4322         | joe     | d4657373888    | 2200 sudderthe road    |wz     | 9543939124 | 4323         | kim     | d0987655432    | 1st elbow street       |km     | 5551234444 | 4324         | sue     | d1234567890    | 742 evergreen terrace  |xy     | 1112223344 

this database accessed , edited few different areas of application. once figured out can accomplish lot overall app.

eventually have app upload transaction record our website...i take on hurdle when comes...

i using code in "next" buttons onclick :

string custname = name.gettext().tostring(); string custlicense = license.gettext().tostring(); string custstate = state.gettext().tostring(); string custaddress = address.gettext().tostring(); string custcity = city.gettext().tostring(); string custzip = zip.gettext().tostring(); string custphone = phone.gettext().tostring(); string custemail = email.gettext().tostring(); string custdriver = driver.gettext().tostring(); 

so guess need figure out how save variables kind of database.

(i kind of use place me figure out need do...so im writing im starting answer own question. :p)

use sqllite, aka class sqlitedatabase. put crud methods in subclass of sqliteopenhelper. there's setting do, write rows database, you'll need code following:

contentvalues values = new contentvalues(); values.put ("custname", custname); values.put ("cuslicense", custlicense); ... getwritabledatabase().insertorthrow ("customerinformation", null, values); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -