0

In my app, I implement the smily features. And I am successfully showing the smiley's in android edit text box. But my problem is that how can I store that in database so next time i can easily show again. if even it includes texts.

Ex: Hi smily.

  • If multiple smily, how to differentiate?
  • If text + smily, how to differentiate?

Any help would be appreciated, thanks!

kalpana c
  • 2,739
  • 3
  • 27
  • 47
  • I think smileis are .png files. They can be stored in two ways. Either store them in sd card and save their urls in database Or save the smilies direct in database. In second case, make a column in database of type "blob". When saving image, convert the image in "bytes" and call the save method of database. – Faizan Mubasher Nov 19 '13 at 08:03
  • Hi, thanks for reply. Actually my smily images are in drawable folders. And I used ImageGetter to display in edittext. – kalpana c Nov 19 '13 at 08:08
  • 1
    I hope ImageGetter returns Drawable. Convert that Drawable into byte array and save it. See this answer http://stackoverflow.com/questions/6341977/convert-drawable-to-blob-datatype-sqlite – Faizan Mubasher Nov 19 '13 at 08:13
  • A database is not the place to store binary data like smileys. Rather store a pointer (name, path, id) of the file in the drawables folder. – jboi Nov 19 '13 at 08:49

0 Answers0