のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

handleMessage

  76     private CrashRecoveryHandler(Controller controller) {
     77         mController = controller;
     78         mContext = mController.getActivity().getApplicationContext();
     79         mForegroundHandler = new Handler();
     80         mBackgroundHandler = new Handler(BackgroundHandler.getLooper()) {
     81 
     82             @Override
     83             public void handleMessage(Message msg) {
     84                 switch (msg.what) {
     85                 case MSG_WRITE_STATE:
     86                     Bundle saveState = (Bundle) msg.obj;
     87                     writeState(saveState);
     88                     break;
     89                 case MSG_CLEAR_STATE:
     90                     if (LOGV_ENABLED) {
     91                         Log.v(LOGTAG, "Clearing crash recovery state");
     92                     }
     93                     File state = new File(mContext.getCacheDir(), STATE_FILE);
     94                     if (state.exists()) {
     95                         state.delete();
     96                     }
     97                     break;
     98                 case MSG_PRELOAD_STATE:
     99                     mRecoveryState = loadCrashState();
    100                     synchronized (CrashRecoveryHandler.this) {
    101                         mIsPreloading = false;
    102                         mDidPreload = true;
    103                         CrashRecoveryHandler.this.notifyAll();
    104                     }
    105                     break;
    106                 }
    107             }
    108         };
    109     }