• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Using encrypted data in CursorAdapter

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

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

I found this helping .
 
Curse your sudden but inevitable betrayal! And this tiny ad too!
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic