0

I am developing an Android app which plot point graph (scatter plot) using android GraphView library. I need to put a background image behind my graph. I tried,

int imageResource = getResources().getIdentifier("@drawable/cyan", null, getPackageName());
myplot.setBackgroundResource(imageResource);

("cyan" is the name of the image (.jpg format) and it is in drawable folder). But nothing happens. Can anyone make some suggestion?

1 Answers1

1

Did you try this:

Drawable image = ContextCompat.getDrawable(this, R.drawable.cyan);
myplot.setBackground(image);
Amiraslan
  • 794
  • 1
  • 8
  • 19