Question: I'm doing Android app using web services. As of now each time getting response from server. If network fails i can't to get data. Activity showing empty screen. Instead of showing empty screen i want to save all data locally.

If network fails i want to get it from locally and show.

How to do that. Please share your valuable ideas.

`IOS` have core data to save values. Is `Android` have any option like that

Answer: 
Create sqlite databse save all data u fetching from server. 

SQLiteDatabase db = getWritableDatabse();

```
ContentValues contentValues = new ContentValues();
contentValues.put("ID", offlineData.getKey());
contentValues.put("RESPONSE_JSON", offlineData.getJson());
contentValues.put("LAST_UPDATED_TIME",
        String.valueOf(offlineData.getUpdatedTime()));
if(recordId==-1) {
    recordId = db.insert(TABLE_NAME, null, contentValues);
}else{
    recordId = db.update(TABLE_NAME, contentValues, "ID " + "="+offlineData.getKey(), null);
}
db.close();

```
Use a custom content provider (which is built on top of sqlite). Many tutorials on the internet describing how to do so

Content provider is similar to core data as they both place a wrapper on sqlite