Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

What happened to my Canvas when callSerially  RSS feed

 
Jialete Fan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Canvas like this:
public class somec extends Canvas implements Runnable{
.....
public void showNotify(){
running = true;
new Thread(this).start();
}
......
public void run(){
while(running){
....
repaint();
callSerially(this) //Warning here,"this" is not Runnable?!!
.......
}
}
public void paint(Graphics g){
.....
}
}
}
What is the problem here? How can I fix it ?
 
Al Brotherton
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As stated in "J2ME in a Nutshell" - "The code to be executed in the event thread should be implimented in the run() method of the Runnable passed to the callSerially() method."
What that says to me is if your "this" is not runnable nothing will be executed
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!