Note that there are some explanatory texts on larger screens.

plurals
  1. POIncrease speed to redraw the Android Screen
    primarykey
    data
    text
    <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>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload