两个activity,一个自定义的view。开始页面(startActivity)--------》游戏页面(mainActivity)----》chessView(棋盘);我想通过开始页面的两个button,选择游戏模式:电脑or玩家;通过intent传入到mainActivity中,但是不知道怎样在chessView中 怎样获取到传入的参数,也不太清楚应该用什么事件来开始游戏???
希望各位大侠帮帮忙,刚刚学习android不长时间,应该学习的地方太多了!!!!

解决方案 »

  1.   

    传参数:
    Intent intent=new Intent(StartActivity.this,mainActivity.class);
    intent.putExtra("player",strPlayer");
    //传递键值对参数到mianActivity  key=player values=strPlayer 
    startActivity(intent);mainActivity中接收参数Intent intent=getIntent();
    String strPlayer=intent.getExtra("player")//接收key=player的values值游戏开始,一般都是通过启动线程!
    Thread.start();
    不断更新数据,更新UI
      

  2.   

    楼上正解,
    UI的更新可以通过message handler来处理
    也就是说,线程中进行计算,计算完后,用message来通知更新UI
      

  3.   

    能不能给个UI更新的例子,比如如果传进来的是computer,调用的是player1run();如果是human调用的是player2run();我看过一个例子,是用的onKeyDown()实现的。 谢谢各位了