setBackground() function very slow

Put your problem here if it does not fit any of the other categories.

setBackground() function very slow

Postby martin_nuke » Thu Jan 10, 2008 3:26 am

The set background() function in threaded canvas applications is very slow

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.  
  3. this.setBackground(getResources().getDrawable(R.drawable.background));
  4.  
  5.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


The solution to make threaded canvas applications faster

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.  
  3. @Override
  4.  
  5. protected void onDraw(Canvas canvas)
  6.  
  7. {
  8.  
  9.      background.setBounds(0, 0, 320, 220);
  10.  
  11.      background.draw(canvas);
  12.  
  13. }
  14.  
  15.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
martin_nuke
Junior Developer
Junior Developer
 
Posts: 15
Joined: Sat Dec 08, 2007 7:44 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: MSNbot Media and 29 guests