public void wait_ble(int i) {
   try {
     Thread.sleep(i);
   } catch (Exception e) {
     // ignore
   }
 }
示例#2
0
 private void sleep(int time) {
   try {
     Thread.sleep(time);
   } catch (InterruptedException e) {
     e.printStackTrace();
   }
 }
示例#3
0
  @Override
  public void run() {
    while (flag) {
      myDraw();
      try {
        Thread.sleep(50);
      } catch (InterruptedException e) {

      }
    }
  }
示例#4
0
 @Override
 protected Void doInBackground(Integer... params) {
   //
   try {
     Thread.sleep(params[0]);
   } catch (InterruptedException e) {
     //
     e.printStackTrace();
   }
   return null;
 }
示例#5
0
  /** 线程运行的方法,当线程start后执行 */
  @Override
  public void run() {

    while (flag) {
      mDraw(); // 调用自定义的绘图方法
      mGameLogic(); // 调用自定义的逻辑方法
      try {
        Thread.sleep(50); // 让线程休息50毫秒
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
示例#6
0
 public void handleMessage(Message msg) {
   mValue++;
   mText.setText(Integer.toString(mValue));
   try {
     Thread.sleep(50);
   } catch (InterruptedException e) {;
   }
   if (mValue < 100 && mQuit == false) {
     mProgress.setProgress(mValue);
     mHandler.sendEmptyMessage(0);
   } else {
     dismissDialog(0);
   }
 }
 @SuppressWarnings("unused")
 @Override
 public void onDestroy() {
   super.onDestroy();
   // Stop the Bluetooth chat services
   if (D) Log.e(TAG, "--- ON DESTROY ---");
   if (false) {
     RunDisConnectionInThread();
     try {
       Thread.sleep(2000);
     } catch (InterruptedException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
   mStatusTimer.cancel();
   finish();
 }
示例#8
0
  @Override
  protected Void doInBackground(Void... v) {
    while (toContinue) {
      try {
        Thread.sleep(interval);
      } catch (InterruptedException e) {
        break;
      }

      HashMap<String, String> currentStatus = getGPIOStatus();
      boolean same = isSame(currentStatus, GPIOStatus);
      Log.i("INFO", String.valueOf(same));
      if (same) continue;

      GPIOStatus = currentStatus;
      publishProgress();
    }
    return null;
  }
    @Override
    protected String doInBackground(String... arg0) {
      // TODO Auto-generated method stub
      String data = null;
      FileInputStream fis = null;

      for (int i = 0; i < 25; i++) {
        // referencing progressupdate method
        publishProgress(4);
        try {
          Thread.sleep(100);
        } catch (InterruptedException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }

      dial.dismiss();
      try {
        fis = openFileInput(FILENAME);
        byte[] arr = new byte[fis.available()]; // getting number of bytes in fis
        while (fis.read(arr) != -1) ; // reading the bytes in fis
        {
          data = new String(arr);
        }
      } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } finally {
        try {
          fis.close();
        } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
      return data;
    }