Introduction
This article explains the parsing of data and storing it in an SQLite database. Android Studio is used to create the sample.
JSON is the acronym for JavaScript Object Notation. JSON data is in two forms, one object data and another is array data that you need to parse to get the real data.
SQLite Database is an open-source data base provided by every Android system. SQLite database is used to create, read and update a database in an Android system. To use the SQLite database you need to extend the SQLiteOpenHelper class. The SQLite open helper class provides the onCreate() and onUpgrade() methods to create an upgraded database.
Step 1
Create a project like this:
Step 2
Create an XML file with this:
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- android:paddingBottom="@dimen/activity_vertical_margin"
- tools:context=".MainActivity"
- android:background="#f610">
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:id="@+id/textView1"
- android:textStyle="bold"
- android:textColor="#ffffff"
- android:textSize="15dp"
- />
-
- <ListView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:id="@+id/listView"></ListView>
-
- </RelativeLayout>