java - How do I retrieve resource name from imagespan drawable? -
i have array of imagespan type contains icons added textedit. called: imagespan[] itemspans;
when want know icon typed in edittext field - loop through array
for (int x = 0; x < itemspans.length; x++) { string icon=""; if (itemspans[x].getdrawable().equals(mywinkiconimageview.getdrawable())) { icon = ":-)"; } }
mywinkiconimageview variable linked imageview control points resource, eg: r.drawable.myicon
this how how it. if bit wrong.
the thing is: want drawable's resource name itemspans[x].getdrawable() instead of pointing imageview control, meaning want know itemspans[x] drawn in edittext rather check imageview.
i wish that:
if (itemspans[x].getdrawable().equals(r.drawable.smiley) { icon=":-)"; } if (itemspans[x].getdrawable().equals(r.drawable.sad) { icon=":-("; }
and on...
again, itemspans[x].getdrawable()
array contain image resources (icons r.drawable.xxxx
) exist in edittext after user typed them. don't know how r.drawable.xxxx
resource name itemspans[x]
in order compare them mentioned above.
Comments
Post a Comment