Android Development,Animation
<p>I'am trying to draw a cloud animation i have ok class to do all draw work but i can't achive to run it.
here is my code(i'm new in this stuff),</p>

<pre><code>public class SampleAnimationActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ok a= new ok(null);
    Canvas cnvs=new Canvas();
    a.onDraw(cnvs);
    setContentView(R.layout.main);
}
</code></pre>

<p>But when i run this code i have an error like "Unexpectedly stopped"</p>

<p>Clould you help me!(Remember this i'm new)</p>

<p>here is ok class</p>

<pre><code>package sample.animation;




public class ok
extends View{
Bitmap cloud;
int x=0;
int y=0;
Paint paint=new Paint();

public ok(Context context) {
    super(context);
    // TODO Auto-generated constructor stub
    cloud=BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);

}
protected void onDraw(Canvas canvas){
    super.onDraw(canvas);

    try {
        Rect cBK=new Rect();
        cBK.set(0,0,canvas.getWidth(),canvas.getHeight());
        Paint pBlue=new Paint();
        pBlue.setStyle(Paint.Style.FILL);
        pBlue.setColor(Color.BLUE);

        canvas.drawRect(cBK,pBlue);

        drawCloud(x,y,canvas);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}
private void drawCloud(int x2, int y2, Canvas canvas) {
    // TODO Auto-generated method stub
    canvas.drawBitmap(cloud, x2, y2,paint );
}
</code></pre>

<p>}</p>
