()
132 | val uri = Uri.parse("content://com.journaler.provider/notes")
133 | val cursor = contentResolver.query(
134 | uri, null, selection.toString(), selectionArgs.toTypedArray(), null
135 | )
136 | while (cursor.moveToNext()) {
137 | val id = cursor.getLong(cursor.getColumnIndexOrThrow("_id"))
138 | val deleted = contentResolver.delete(
139 | uri, "_id = ?", arrayOf(id.toString())
140 | )
141 | if (deleted > 0) {
142 | Log.v(
143 | tag,
144 | "Notes deleted [ $deleted ]"
145 | )
146 | } else {
147 | Log.e(
148 | tag,
149 | "Notes not deleted"
150 | )
151 | }
152 |
153 |
154 | }
155 | cursor.close()
156 | }
157 | }
158 | task.execute()
159 | }
160 | }
161 |
162 | }
--------------------------------------------------------------------------------
/Journaler/content_provider_client_example/src/main/res/drawable/main_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/-Mastering-Android-Development-with-Kotlin/c09c0cee8c7af997d05b6db5bdbaf55a6d9b00e3/Journaler/content_provider_client_example/src/main/res/drawable/main_icon.png
--------------------------------------------------------------------------------
/Journaler/content_provider_client_example/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
18 |
19 |
24 |
25 |
30 |
31 |
--------------------------------------------------------------------------------
/Journaler/content_provider_client_example/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Journaler Content Provider Client Example
3 | Select data
4 | Insert data
5 | Update data
6 | Delete data
7 |
8 |
--------------------------------------------------------------------------------
/Journaler/content_provider_client_example/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Journaler/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':content_provider_client_example'
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # Journaler #
5 |
6 | Journaler, make your notes and todos with a style ;)
7 |
8 | ### Download a free PDF
9 |
10 | If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.
11 | https://packt.link/free-ebook/9781788473699
--------------------------------------------------------------------------------
/notes.txt:
--------------------------------------------------------------------------------
1 | Journaler notes
2 |
--------------------------------------------------------------------------------