i have crated two custom view and i want to switch that view
<p>can any one tell why this code is not working ?it always force to end  i want to switch the view but it is not happening .can any one help on this ?either it force to kill or show black screen.i  am want to switch the four views so plesae help me .ar can any one help me to creat the animation.</p>

<pre><code> public class DrawDemoActivity extends Activity {
        DemoView demoview ;
        FinalView finalview;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        boolean first=true;
        boolean sec=false;
        demoview = new DemoView(this);
        finalview = new FinalView(this);
           // for contnivew switching the view 
        for(int i=0;i&gt;0;i++)
        {
            if (first==true||sec==false)
            {

                setContentView(finalview);
                first=false;
                sec=true;
            }else if(first==false||sec==true)
            {
                setContentView(demoview);
                first=true;
                sec=true;
            }else if(first==true||sec==true)
            {
                setContentView(demoview);
                first=false;
                sec=false;
            }else
            {   
                setContentView(demoview);
                first=false;
                sec=false;
            }
        }
    }
//first view 
    private class DemoView extends View{
        public DemoView(Context context){
            super(context);
        }

        @Override protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);

            // custom drawing code here
            // remember: y increases from top to bottom
            // x increases from left to right
            int x = 150;
            int y = 200;
            Paint paint = new Paint();
            paint.setStyle(Paint.Style.FILL);

            // make the entire canvas white
            paint.setColor(Color.CYAN);
            canvas.drawPaint(paint);
            // another way to do this is to use:
            // canvas.drawColor(Color.WHITE);

            // draw blue circle with antialiasing turned on
            paint.setAntiAlias(true);

            paint.setColor(Color.RED);
            canvas.drawCircle(x-24, y+30, 11, paint);
            paint.setColor(Color.WHITE);            
            canvas.drawLine(0, 300 , 320, 300, paint);
        }
    }
    //second view 
        private class FinalView extends View {
            public FinalView(Context context){
        super(context);
        }

            @Override 
            protected void onDraw(Canvas canvas) {
                super.onDraw(canvas);
                // custom drawing code here
                // remember: y increases from top to bottom
                // x increases from left to right
                int x = 150;
                int y = 200;
                Paint paint = new Paint();
                paint.setStyle(Paint.Style.FILL);

                // make the entire canvas white
                paint.setColor(Color.CYAN);
                canvas.drawPaint(paint);
                // another way to do this is to use:
                // canvas.drawColor(Color.WHITE);

                // draw blue circle with antialiasing turned on
                paint.setAntiAlias(true);


                paint.setColor(Color.BLACK);
                canvas.drawCircle(x, y, 11, paint);
                canvas.drawCircle(x-11, y+19, 11, paint);
                canvas.drawCircle(x, y+38, 11, paint);
                canvas.drawCircle(x+20, y+30, 11, paint);
                canvas.drawCircle(x-11, y-19, 11, paint);


                paint.setColor(Color.RED);
                canvas.drawCircle(x+41, y+30, 11, paint);
                canvas.drawCircle(x+20, y+9, 11, paint);
                canvas.drawCircle(x-23, y-37, 11, paint);

                canvas.drawLine(0, 300 , 320, 300, paint);      
          }
    }
}
</code></pre>
