How to retrieve drawable (picture) from a view?
<p>I wrote code to draw on a view. After it is done, how can I get the resulting image from the view. For example, in the code below, I want to get the the drawable (Image) from mCustomDrawableView. How can I do that? Thanks.</p>

<pre><code>public class HelloTestGraph extends Activity {
    /** Called when the activity is first created. */

    // @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);
        LinearLayout lo = (LinearLayout) findViewById(R.id.top_view);
        LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);

        CustomDrawableView mCustomDrawableView = new CustomDrawableView(this);
        mCustomDrawableView.setLayoutParams(param);
        lo.addView(mCustomDrawableView);
    }

    public class CustomDrawableView extends View {
        private ShapeDrawable mDrawable;
        private Drawable mPic;

        public CustomDrawableView(Context context) {
            super(context);

            int x = 10;
            int y = 10;
            int width = 300;
            int height = 50;

            mDrawable = new ShapeDrawable(new OvalShape());
            mDrawable.getPaint().setColor(0xff74AC23);
            mDrawable.setBounds(x, y, x + width, y + height);

            mPic = getResources().getDrawable(R.drawable.example_picture);
            mPic.setBounds(x, y + 100, x + width, y + height+100);
        }

        protected void onDraw(Canvas canvas) {
            mDrawable.draw(canvas);
            mPic.draw(canvas);
        }
    }
}
</code></pre>
