Creating a simple project using SQLite database in Android Studio and displaying data in ListView. Later, it seemed like adding an avatar image and then add an avatar before the username.
After adding an image from the gallery camera when clicking on the display button below, an error is happening.
Caused by: android.database.sqlite.SQLiteException: unknown error (code 0): Unable to convert BLOB to string
at android.database.CursorWindow.nativeGetString(Native Method)
at java.lang.reflect.Method.invoke(Native Method)
Why getting unknown error (code 0): Unable to convert BLOB to string in android studio?
Created a project in Android studio using SQLite database then the project runs successfully but then need to add an image. Then pick an image from camera gallery and stored it in SQLite database.
It’s amazing because a complete project is completed, and a new idea comes along to add an avatar. Also added functionality to select an image from gallery or camera and set it in ListView. Then add an avatar before the username. All work is done successfully, Image store on SQLite database, but when clicking on “Display” getting error “Unknown error (code 0)): Unable to convert BLOB to string.” This is absolutely unknown error. Tried all methods but not resolved, Initialization was checked but not resolved. But when click on the error destination, then that error appears on the username. Don’t understand why username is getting error. The question arises in the mind that only the error is coming on the username.
How to resolve unknown error (code 0): unable to convert BLOB to string
Finally, the above type of error got resolved. For sure, got that error a different way. But here this error was happening because of the sequence. Yes, sequence. As you know, an avatar was added before the username and column index changed. In addition, there are 19 column indexes. Then added the new “Avatar Image” column index at the last. But because of adding the last column index, getting an error Unknown error (code 0): Unable to convert BLOB to string, then changed the column index to first instead of last. And run the project and click on Display. The project run successfully and resolved the error (code 0): Unable to convert BLOB to string error.
Finally, found a solution “Unknown error (code 0): Unable to convert BLOB to string”
The error was caused by a sequence. But this error can also happen for a different reason.
If you are getting this type of error, then the reason for this error may be different.