Passing a value from activity to thread after thread is already created

Viewed 1479

In my android program an Activity calls a new surface view class, which then in turn calls a new thread class. I want to be able to pass a value to the thread class from the activity's onPause and onResume methods, so I can pause and resume the thread. The only way I know to pass this data is by creating a new instance, which would just create a different thread. How should I go about this without creating a new thread instance?

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(new GameSurface(this));
}

@Override
protected void onResume() {
    super.onResume();
            //Would like to pass this value
            int state = 1;
}

@Override
protected void onPause() {
    super.onPause();
            //Would like to pass this value
            int state = 2;
}
3 Answers
Related