Search code examples
androidtextviewback

how set runtime background image in textview in android?


i want to set runtime background in textview in android here you can see i have a one image which is runtime set this is not fix so i want to change runtime background in textview and current location in text with different color

 holder.textmenu.setBackgroundDrawable(R.Drawable.imagename) // gives error
 holder.textmenu.setBackgroundColor(R.color.color_orange);`

enter image description here


Solution

  • It should be

    holder.textmenu.setBackgroundResource(R.Drawable.imagename)