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

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -