unable to convert BLOB to string in android

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 android.database.CursorWindow.getString(CursorWindow.java:438)

        at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51)

        at com.example.resumeapp.Activities.Displaydata.dis(Displaydata.java:100)

        at com.example.resumeapp.Activities.Displaydata.onCreate(Displaydata.java:60)

        at android.app.Activity.performCreate(Activity.java:6008)

        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)

        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2255)

        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2375) 

        at android.app.ActivityThread.access$800(ActivityThread.java:148) 

        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1282) 

        at android.os.Handler.dispatchMessage(Handler.java:102) 

        at android.os.Looper.loop(Looper.java:135) 

        at android.app.ActivityThread.main(ActivityThread.java:5240) 

        at java.lang.reflect.Method.invoke(Native Method) 

        at java.lang.reflect.Method.invoke(Method.java:372) 

        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950) 

        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745) 

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.

Unknown error (code 0): unable to convert BLOB to string

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.

Unable to convert BLOB to string solved

If you are getting this type of error, then the reason for this error may be different.

Leave a Reply