/** * Use this method to add data to the content provider * * @param reposArrayList list of {@link Repo} */ private void cacheData(ArrayList<Repo> reposArrayList) { ContentValues contentValues; for (Repo repo : reposArrayList) { contentValues = new ContentValues(); contentValues.put(RepoEntry.COLUMN_NAME, repo.getName()); contentValues.put(RepoEntry.COLUMN_OWNER_NAME, repo.getOwner_name()); contentValues.put(RepoEntry.COLUMN_DESCRIPTION, repo.getDescription()); contentValues.put(RepoEntry.COLUMN_OWNER_URL, repo.getOwner_url()); contentValues.put(RepoEntry.COLUMN_REPO_URL, repo.getRepo_url()); contentValues.put(RepoEntry.COLUMN_FORK, repo.isFork() ? 0 : 1); // insert the content value to the content provider getActivity().getContentResolver().insert(RepoEntry.CONTENT_URI, contentValues); } }