Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using encrypted data in CursorAdapter

 
yash wardhan
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have some data in table,(say _id,name), name is encrypted where as id is auto generated value.
I want to show the data in a ListView and I'm using SimpleCursorAdapter for keyvalue mapping.
But I am getting an error saying
android.database.sqlite.SQLiteException: unknown error: Unable to convert BLOB to string

This is because the encrypted data is stored in byte[].
My question is,
how can I convert the name column into original string and show in ListView?
I have a method for decryption.
Actually I want a functionality as, when user clicks on Name in the list, I should get corresponding id and I found SimpleCursorAdapter doing same thing as given in Notepad sample.

Waiting for help, thanks in advance
 
yash wardhan
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any replies.

I found an article here.

I am able to do my work as expected following the article but I am not getting each name on each row of list, I am getting same name (first from db) on each row, however, when I check the id in onListItemClick() method I am getting correct id for each name.

How to solve this problem?
Please reply
 
yash wardhan
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I debugged the adapter I found that my getView() method is getting called twice the number of rows in the database.
Why is it happening, I think that is the problem that I am getting same name.

Waiting for help from anyone
 
yash wardhan
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

The problem is solved by changing height attribute in xml files.

I found this helping .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic