0

Currently I'm learning android development and I am struggling where should I put my data. Since this is just a test. data will not be stored in a webserver

for now I have created an app that accepts text input from the user. The Inputted data by the user is being processed and get compared to a list of data with specific response.

For Example

The user Inputs Hello. The inputted data will be compare to a list of data and if equal it will get the the specific response

data: hi                 response: hello
data: hello              response: hi
data: what's your name   response: I'm Ivy
data: how are you        response: I'm fine
data: Who are you        response: I'm your phone

and many more...

since the user input is hello then the response that I will get is hi.

Now. Where should I put the list of data? I am new to sqlite and still learning about it. Should I create a table on Sqlite and insert all the data? Correct me if I'm wrong. What if I have a thousand of data running a thousand sql query may cause a problem when?

Should I do something like?

  myDB = this.openOrCreateDatabase("DatabaseName", MODE_PRIVATE, null);

       /* Create a Table in the Database. */
       myDB.execSQL("CREATE TABLE IF NOT EXISTS "
         + TableName
         + " (Field1 VARCHAR, Field2 INT(3));");

       /* Insert data to a Table*/
       myDB.execSQL("INSERT INTO "
         + TableName
         + " (Field1, Field2)"
         + " VALUES ('Saranga', 22);");
       ...

Also I'm using levenshtein to compare string.

How does the sqlite cycle works? does the database get created when the app is run or when the app was installed?

1 Answer 1

1

it basically depends on app and business requirement, Among many methods some are listed below for your learning and as being beginner as well

1- File based persistence in Android

2- Android SQLlite and Content Providers

Conventionally, Your data storage options are the following:

Shared Preferences

Store private primitive data in key-value pairs.

Internal Storage

Store private data on the device memory.

External Storage

Store public data on the shared external storage.

SQLite Databases

Store structured data in a private database.

Network Connection

Store data on the web with your own network server.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.