Skip to content

AlphaDelta9/Android-Bootcamp2020-Day2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

A Brief Review of What we learnt today

Shared Preferences

If you want to save a small data, especially a primivite data type, shared preferences is the best choice. Shared Preferences lets you save your data to XML file that can be accessed from

Device File Manager in android studio > data > data > your_apps_package > shared_pref

for security purpose, you can encrypt your key and value data before saving the data to xml. you can save whether the user is already logged in or not, user settings, and so on.

SQLite

If you want to save more complex data, maybe in some case shared preferences is not fit to your needs. instead, use SQLite. SQLite is pretty similar to MSSQL or MySQL. You can create a database, table, column, constraint in each column, and so on. The CRUD operation is easy to perform. SQLite provide some method to generate a query for CRUD operation like insert, update, delete. You can save and get some data if the device is offline, and save other local data.

Networking

to perform some request to api webservice, you can use volley. but it is not the only option. there are 2 more ways to perform api request, is by using async task or retrofit. There are 2 type of request in volley :

    1. JsonObjectRequest : is used if the response is in Json Array
    2. JsonArrayRequest  : is used if the response is in Json Object

both of this type have a same parameter that you should provide :

   1. Method (POST, GET, DELETE, PUT, etc.)
   2. URL
   3. Parameter (in Json)
   4. Response Callback
   5. Error Response Callback

don't forget to add the request to RequestQueue.

About

Shared Preferences | SQLite | Networking (Volley)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%