Hi
I have a task to be run on a secondary thread defined in the class Activity
Using java Syntax Highlighting
public Myapp extends Activity{
private count;
public Myapp(){}
public void task(){
//process count
}
}
Parsed in 0.031 seconds, using
GeSHi 1.0.8.4
It is optimal to place the method task inside Myapp class because it utilizes a lot of the private variables defined there. The problem is I need to call it from another class extending View. As shown above, I created a Myapp constructor just so I can call task from MyView as shown below
Using java Syntax Highlighting
public void MyView extends SurfaceView implements SurfaceView.Callback{
public void surfaceCreated(){
new Myapp().task();
}
}
Parsed in 0.030 seconds, using
GeSHi 1.0.8.4
This program doesn't work, and I don't know if it's because of my creating a constructor inside Activity. I've never seen this done anywhere, so I'm uncertain about it. Is this ok and the bug is something else?
Thanks for looking