我是android studio的新手。我需要将活动类中的整数值传递给android studio中的非活动类。
活动类:
public class Main2Activity extends Activity {
// enter code here
}
非活动类:
public class GameView extends View {
public GameView(Context context, Maze maze){ }
}
答案 0 :(得分:0)
for simplest, use constructer
like:
public class Main2Activity extends Activity
{
int x=5;
GameView view =new GameView(x)
}
public class GameView extends View {
int y;
GameView(int y){
this.y=y;
}
//your values has been passed
}