Reputation: 1
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?
Upvotes: 0
Views: 263
Reputation: 812
Did you try this:
Drawable image = ContextCompat.getDrawable(this, R.drawable.cyan);
myplot.setBackground(image);
Upvotes: 1