Dianna
Dianna

Reputation: 65

how can i make image span clickable in Android?

I have an ExpandableListView and in the ViewGroup method i have an image span set to some textview like this:

String statusText = postsList.get(groupPosition).get(TAG_userStatus).substring(urlStr.length(), postsList.get(groupPosition).get(TAG_userStatus).length()); 
Bitmap bm = BitmapFactory.decodeFile(urlStr);//urlStr is the path to my image: /mnt/sdcard/1.jpg
Bitmap resized = Bitmap.createScaledBitmap(bm, 200, 200, true);                                 
TextView userStatus1 = (TextView)v.findViewById( R.id.userStatus );
SpannableStringBuilder ssb = new SpannableStringBuilder(" "+statusText );
ImageSpan span = new ImageSpan(resized, ImageSpan.ALIGN_BOTTOM);    

ssb.setSpan( span, 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE );  
userStatus1.setText( ssb, BufferType.SPANNABLE );

I need to be able to click on the image and show it in full screen.But I don't know how to make the image clickable. I have read similar threads but nothing works for me. I think it's because expandableListView but I'm not sure. I hope you can help me. Thank you!

Upvotes: 1

Views: 1451

Answers (0)

Related Questions