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 4325282
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:14:44+00:00 2026-05-21T09:14:44+00:00

http://www.helloandroid.com/tutorials/how-use-canvas-your-android-apps-part-1 At the end of this tutorial link for source code download is available.

  • 0

http://www.helloandroid.com/tutorials/how-use-canvas-your-android-apps-part-1

At the end of this tutorial link for source code download is available.
I downloaded the code and tried this example , It draws a kangaroo in the screen and within 1-2 minutes i get a crash/the application froze.

I tried on Archos 70 Internet Tablet.

“I would like to know the reason, or if some thing is wrong in this “

Here is the LogCat

04-13 17:03:24.089: DEBUG/ondraw(2070): lefutott
04-13 17:03:24.097: DEBUG/ondraw(2070): lefutott
04-13 17:03:24.113: DEBUG/ondraw(2070): lefutott
04-13 17:03:24.128: DEBUG/ondraw(2070): lefutott
04-13 17:03:24.136: DEBUG/ondraw(2070): lefutott
04-13 17:03:24.152: DEBUG/ondraw(2070): lefutott
04-13 17:03:24.167: DEBUG/ondraw(2070): lefutott
04-13 17:03:24.175: DEBUG/ondraw(2070): lefutott
04-13 17:04:10.019: WARN/ActivityManager(1302): Timeout of broadcast BroadcastRecord{457f99c8 android.intent.action.TIME_TICK} – receiver=android.app.ActivityThread$PackageInfo$ReceiverDispatcher$InnerReceiver@4561a5c8
04-13 17:04:10.019: WARN/ActivityManager(1302): Receiver during timeout: BroadcastFilter{454ed4c8 ReceiverList{454fbd70 1302 system/1000 local:4561a5c8}}
04-13 17:04:38.972: INFO/Process(1302): Sending signal. PID: 1302 SIG: 3
04-13 17:04:38.972: INFO/dalvikvm(1302): threadid=3: reacting to signal 3
04-13 17:04:39.097: INFO/dalvikvm(1302): Wrote stack traces to ‘/data/anr/traces.txt’
04-13 17:05:09.097: INFO/Process(1302): Sending signal. PID: 1302 SIG: 3
04-13 17:05:09.097: INFO/dalvikvm(1302): threadid=3: reacting to signal 3
04-13 17:05:09.128: INFO/dalvikvm(1302): Wrote stack traces to ‘/data/anr/traces.txt’
04-13 17:05:09.128: INFO/Process(1302): Sending signal. PID: 1433 SIG: 3
04-13 17:05:09.128: INFO/dalvikvm(1433): threadid=3: reacting to signal 3
04-13 17:05:09.144: INFO/dalvikvm(1433): Wrote stack traces to ‘/data/anr/traces.txt’
04-13 17:05:11.144: INFO/Watchdog_N(1302): dumpKernelStacks
04-13 17:05:11.144: ERROR/Watchdog_N(1302): Unable to open stack of tid 1302 : 13 (Permission denied)
04-13 17:05:11.144: ERROR/Watchdog_N(1302): Unable to open stack of tid 1303 : 13 (Permission denied)

  • 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-21T09:14:45+00:00Added an answer on May 21, 2026 at 9:14 am

    The onDraw looks like this:

        @Override
        public void onDraw(Canvas canvas) {
    
                Paint paint = new Paint();
    
    
                Bitmap kangoo = BitmapFactory.decodeResource(getResources(),
                                R.drawable.kangoo);
                canvas.drawColor(Color.BLACK);
                canvas.drawBitmap(kangoo, 10, 10, null);
        }
    

    So each time it runs, it’s creating a new paint and possibly (I’ve not used the BitmapFactory), creating a new bitmap. This seems like overkill (particularly, since the paint isn’t used, although it does seem to be in part 2). I’d consider moving these bits to the constructor for the panel to see if it makes a difference, something like:

    public class Panel extends SurfaceView implements SurfaceHolder.Callback{
        // rest of class ignored for brevity
    
        private Paint paint;
        private Bitmap kangoo;
    
        public Panel(Context context, AttributeSet attrs) {
        super(context, attrs); 
        getHolder().addCallback(this);
        canvasthread = new CanvasThread(getHolder(), this);
        setFocusable(true);
             paint = new Paint();
    
    
             kangoo = BitmapFactory.decodeResource(getResources(),
                                R.drawable.kangoo);
    }
    
        @Override
        public void onDraw(Canvas canvas) {                
                canvas.drawColor(Color.BLACK);
                canvas.drawBitmap(kangoo, 10, 10, null);
        }
    }
    

    It may also be worth running it in the emulator to see if you get the same problem, or if it is device specific.

    EDIT:
    It’s also worth noting that the run() method in the CanvasThread class doesn’t have any sleeps in it, so it’s running as fast as it can, redrawing the screen. This is probably ok for a tutorial, but in a real app I would expect some kind of target frame rate with an appropriate sleep in the run method, otherwise it seems like you would be using an awful lot of cpu cycles (and presumably battery) that the user probably isn’t going to notice.

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

Sidebar

Related Questions

I try this tutorial for building a Widget for Android Homescreen. http://www.helloandroid.com/files/xmaswidget/android_howto-hellowidget.pdf But if
http://www.switchonthecode.com/tutorials/getting-started-with-opengl-es-for-the-iphone From the above link they created tutorial by No Nib File. But i
I am using the code from this website (http://www.helloandroid.com/tutorials/using-threads-and-progressdialog) in my App. It is
i tried the example from http://www.helloandroid.com/tutorials/using-ksoap2-android-and-parsing-output-data to get request and response from a wsdl
http://www.sitepoint.com/build-to-do-list-30-minutes/ So I was doing this (http://www.sitepoint.com/build-to-do-list-30-minutes/) tutorial and everyting went OK. but now
http://www.html5canvastutorials.com/webgl/html5-canvas-webgl-plane-with-three-js/ In this example its just a rotating plane. I'm an html 5 beginner
http://www.docjar.com/html/api/org/apache/catalina/realm/JDBCRealm.java.html To use this JDBCRealm we need two tables, user and user_role. user table
http://www.mapleboutique.com/_blog/maple_blog can someone explain what's going on here? according to this link: http://austinmatzko.com/2007/07/25/internet-explorer-7-float-bug/ –I
http://www.devx.com/wireless/Article/39101/0/page/2 I have followed this tutorial and got it to work and everything. now
http://www.geocities.com/CapeCanaveral/Hall/2027/alfabeto.txt part of it: procedure f /martina go 20 rt 90 go 10 lt

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.