コード例 #1
0
 @Override
 public void onAttach(Activity activity) {
   super.onAttach(activity);
   try {
     fragmentListener = (FullFragmentListener) activity;
   } catch (ClassCastException ex) {
     ex.printStackTrace();
   }
 }
コード例 #2
0
ファイル: ActivityGame.java プロジェクト: tzachs/Trivia
  private void initializeGameSettings() {

    // m_Random = new Random(1);
    m_Random = new Random(System.currentTimeMillis());

    try {
      mTimeToAnswerQuestion =
          Integer.parseInt(m_SharedPreferences.getString("editTextPreferenceCountDownTimer", "10"));
      mTimeToAnswerQuestion *= 1000;

    } catch (ClassCastException e) {
      mTimeToAnswerQuestion = 10000;
      Log.e(TAG, e.getMessage().toString());
    }
    try {
      mDelayBetweenQuestions =
          Integer.parseInt(
              m_SharedPreferences.getString("editTextPreferenceDelayBetweenQuestions", "500"));
    } catch (ClassCastException e) {
      Log.e(TAG, e.getMessage().toString());
    }
  }