private void setState(int state) {
   mPlayState = state;
   switch (mPlayState) {
     case STATE_GAMEOVER:
       m_Handler.removeCallbacks(mDismissResultTask);
       m_Handler.removeCallbacks(mUpdateTimeTask);
       m_Handler.removeCallbacks(mBlinkTimeTask);
       mTimeIsBlinking = false;
       showMessage("Fim de jogo", 40);
       m_word.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.check_button_blank, 0);
       m_word.setEnabled(false);
       m_start_button.setVisibility(View.VISIBLE);
       m_playboard.setKeepScreenOn(false);
       m_playboard.setClickable(false);
       mBoardGameLogic.clearAll();
       // if(m_answers.size() > 0)
       //	break;
       ArrayList<PlayBoard.Coordinate> word = mBoardGameLogic.getMasterWord();
       String current_word = "";
       int size = mBoardGameLogic.getMasterWord().size();
       for (int i = 0; i < size; ++i) {
         PlayBoard.Coordinate pos;
         pos = word.get(i);
         m_playboard.setTile(PlayBoard.SELECTED, pos.x, pos.y);
         current_word += m_playboard.getTextAtPos(pos.x, pos.y);
       }
       m_word.setText(current_word);
       mPlayTime.setVisibility(View.VISIBLE);
       m_playboard.invalidate();
       Intent myIntent = new Intent(PlayGameActivity.this, ScoreSaveActivity.class);
       myIntent.putExtra("score", m_score);
       myIntent.putExtra("playtime", m_allowedTime);
       String answer_list = "";
       for (String answer : m_answers) {
         answer_list += "," + answer;
       }
       myIntent.putExtra("words", answer_list);
       startActivity(myIntent);
       break;
   }
 }
        public void run() {
          switch (mDemoState) {
            case 0:
              showMessage(
                  "Toque em letras adjacentes\n"
                      + "procurando formar palavras\ncom pelo menos 4 letras.\n"
                      + "Quando terminar uma palavra toque no botão.",
                  20);
              m_Handler.postDelayed(this, 5000);
              ++mDemoState;
              break;
            case 1:
            case 4:
              m_text_status.setVisibility(View.INVISIBLE);
              ArrayList<PlayBoard.Coordinate> word = mBoardGameLogic.getMasterWord();
              PlayBoard.Coordinate pos;
              String current_word = "";
              for (int i = 0; i < m_demo_word_i; ++i) {
                pos = word.get(i);
                m_playboard.setTile(PlayBoard.SELECTED, pos.x, pos.y);
                current_word += m_playboard.getTextAtPos(pos.x, pos.y);
              }
              pos = word.get(m_demo_word_i);
              current_word += m_playboard.getTextAtPos(pos.x, pos.y);
              m_playboard.setTile(PlayBoard.LAST_SELECTED, pos.x, pos.y);

              m_word.setText(current_word);

              int button_img =
                  (current_word.length() > 3) ? R.drawable.question : R.drawable.check_button_blank;
              m_word.setCompoundDrawablesWithIntrinsicBounds(0, 0, button_img, 0);
              m_word.setEnabled(current_word.length() > 3);
              m_word.setClickable(false);

              m_playboard.invalidate();
              m_Handler.postDelayed(this, 1000);
              if (++m_demo_word_i == word.size()) mDemoState++;
              break;
            case 2:
              showResult("SABONETE", "certa", 0xAA00FF00);
              m_Handler.postDelayed(this, 3000);
              mDemoState++;
              break;
            case 3:
              m_demo_word_i = 0;
              m_text_status.setVisibility(View.INVISIBLE);
              mBoardGameLogic.startGame("PORTUGAL");
              m_playboard.invalidate();
              m_Handler.postDelayed(this, 1000);
              mDemoState++;
              break;
            case 5:
              showResult("PORTUGAL", "errada", 0xAAFF0000);
              m_Handler.postDelayed(this, 2200);
              mDemoState++;
              break;
            case 6:
              showMessage("Não são aceites nomes próprios.", 20);
              m_Handler.postDelayed(this, 5000);
              mDemoState++;
              break;
            case 7:
              finish();
          }
        }