Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7398261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:50:55+00:00 2026-05-29T03:50:55+00:00

I am new to Android.My application requires to redraw a canvas circle over and

  • 0

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.

My code is as follows:

–> ImagePracActivity.java

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();            
      }
   }

–> movement.java

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<(display.getWidth()/2))
        {
          canvas.drawCircle(x++, y--, 5, paint);
        }           
          else if(x<(display.getWidth()))
        {
          canvas.drawCircle(x++, y++, 5, paint);
        }       

        this.invalidate();
    }    
          public boolean onTouch(View arg0, MotionEvent arg1) {
        // TODO Auto-generated method stub
        return false;
    }    
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T03:50:56+00:00Added an answer on May 29, 2026 at 3:50 am

    A would advice you to use SurfaceView class instead of View, because SurfaceView faster and allows you to have all drawing logic in separate thread. Read more about SurfaceView : http://developer.android.com/guide/topics/graphics/2d-graphics.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are designing a new application for Android and we want to make it
I'm new to Android development and working on an Android application that requires the
I am currently developing an android application which requires two devices to communicate over
i am creating a new android application.i am using the table layout. I have
I am new to android application development. I need a solution for setting random
i m new to this android application development i would be very much grateful
I am new to android and developing a navigation based application for android.My question
I'm new to android development. I'm developing an application for android 4.0.3 devices, in
I am quite new to Java and am currently coding an Android application. In
I would like some help about an Android Application. I used the new Google

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.