开发者

String and character sequence error (force close) Android

I am facing a problem in solving this issue.

I have 30 smiley images. In a grid view I display all the 30 images. So when I select the image based on the position of the image, the corresponding special character will be displayed from SQLite DB. Before I send message to service it is like "hi :)". What I need is to replace the ":)" with the corresponding smiley image in the local folder of my project (eg. R.drawable.facea.png). I am able to fetch the data and replace ":)" with "aaaaa"(example). But when I try to replace the ":)" with Char Sequence (Image), I get 'force close error'. Where am I going wr开发者_Python百科ong?

I have a function to draw image and I get image as in Character Sequence. How can I use the value in this function globally. I also tried to create a global variable and use the CS value globally. But I still get 'force close error.


You need to use a span (specifically an ImageSpan) to be able to embed bitmap in a string. I have written about this on my blog which also covers some common pitfalls.

If you still cannot get it to work I would suggest posting the precise details of what is going wrong: i.e. your code, and the stacktrace that is getting dumped to logcat.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜