Skip to content

Instantly share code, notes, and snippets.

@larrytech7
Created March 17, 2015 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larrytech7/e49b911769ed677f255f to your computer and use it in GitHub Desktop.
Save larrytech7/e49b911769ed677f255f to your computer and use it in GitHub Desktop.
# JSON_DB
This is a NoSQL implementation of a local database for android. It uses the JSON APIs amongst other standard Android APIs. It can be used to setup a quick NoSQL database in android. It has the same advantages as any other NoSQL database. It is easy to setup and to get started.
Getting started Guide
Installation
To use the library in yoUr project , just import the bin/json_db.jar file into your class path.
however , you could also add the project as an external Library in eclipse by adding it under the libraries in your project configuration.
Usage
just like any other database , one can store and retrieve data.
To store data say a set of devices, the following code is used
Context context = this ;
String datakey = "DEVICES";
JSON_DB myDb = new JSON_DB(context ,datakey);
// here you can loop through a set of data and populate an arraylist
String[] mdevices = {};
ArrayList<String> myList= new ArrayList<String>();
for(String dev1 : mdevices){
myList.add(dev1);
}
myDb.put(mdevices).save(); //this lines saves the data
To retrieve the data, all you need is to get a reference to your database handler and call get on ther object.
JSON_DB mDB = new JSON_DB (context , datakey );
ArrayList mylist =mDB.get();
Here , the ArrayList object contains a list of all the devices stored in it.
@larrytech7
Copy link
Author

This gist describes how to use the library to add support for NoSQL on android for your applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment