title: Increase speed to redraw the Android Screen
body: <p>I am new to Android.My application requires to redraw a canvas circle over and over again. However, the speed of redraw is less than what I want. How may I increase the same.</p>
  
  <p>My code is as follows:</p>
  
  <p>--> ImagePracActivity.java    </p>
  
  <pre><code>package com.pkg.ImagPrac;
  
    import android.app.Activity;
    import android.os.Bundle;
    import android.view.Window;
    import android.view.WindowManager;
  
     public class ImagePracActivity extends Activity {
        //DrawView drawView;
          movement mv;
  
     @Override
       public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          // Set full screen view
          getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                                           WindowManager.LayoutParams.FLAG_FULLSCREEN);
          requestWindowFeature(Window.FEATURE_NO_TITLE);    
  
          mv=new movement(getApplicationContext());            
          setContentView(mv);            
          mv.requestFocus();            
        }
     }
  </code></pre>
  
  <p>--> movement.java</p>
  
  <pre><code>package com.pkg.ImagPrac;
  
  import android.content.Context;
  import android.content.Intent;
  import android.graphics.Canvas;
  import android.graphics.Color;
  import android.graphics.Paint;
  import android.util.Log;
  import android.view.Display;
  import android.view.MotionEvent;
  import android.view.View;
  import android.view.View.OnTouchListener;
  import android.view.WindowManager;
  
  public class movement extends View implements OnTouchListener{    
      Display display;
      float x=0,y=0;
      Paint paint=new Paint();
      private boolean flag;
  
      public movement(Context context) {
          super(context);         
          setFocusable(true);
          setFocusableInTouchMode(true);    
          this.setOnTouchListener(this);
  
          paint.setColor(Color.BLUE);
          paint.setAntiAlias(true);
  
          display = ((WindowManager)   
          context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
          x = 0;
          y = display.getHeight();            
      }
  
        @Override
           protected void onDraw(Canvas canvas) {             
  
             if(x&lt;(display.getWidth()/2))
          {
            canvas.drawCircle(x++, y--, 5, paint);
          }           
            else if(x&lt;(display.getWidth()))
          {
            canvas.drawCircle(x++, y++, 5, paint);
          }       
  
          this.invalidate();
      }    
            public boolean onTouch(View arg0, MotionEvent arg1) {
          // TODO Auto-generated method stub
          return false;
      }    
  }
  </code></pre>