Using Handy Storage with content providers - Zalizyaka-Ney/handy.storage GitHub Wiki

The framework can be used for parsing data from results of queries from a content provider and for converting objects into ContentValues.

public class Contact implements Model {

	@Column(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)
	private String name;

	@Column(ContactsContract.CommonDataKinds.Phone.DATA1)
	private String phone;

	@Column(ContactsContract.CommonDataKinds.Phone.PHOTO_THUMBNAIL_URI)
	private String photoUri;
}

ModelAdapter<Contact> modelAdapter = handyStorage.getModelAdapter(Contact.class);

// read objects
Cursor cursor = context.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);
List<Contact> contacts = modelAdapter.cursorToModels(cursor);

// convert object to ContentValues
ContentValues cv = modelAdapter.modelToContentValues(contact);
⚠️ **GitHub.com Fallback** ⚠️