1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public class PieChartDemo01View extends View 
{
public PieChartDemo01View(Context context) 
{
    super(context);
    Drawable drawable = super.getResources().getDrawable(
        R.drawable.bg2);
    BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;

}
}


this code is work then accept my answer and also upvote this.