public void msleep(int a) { try { Thread.sleep(a); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public void set_3g_enable(boolean enable) { enable_3g = enable; Message m = new Message(); m.what = UPDATE_SETTING_SUCCESS; set3g_handler.sendMessage(m); try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public void set_airplane(boolean air) { if (air == true) enable_airplane = true; else enable_airplane = false; Message m = new Message(); m.what = UPDATE_SETTING_SUCCESS; setairplane_handler.sendMessage(m); try { Thread.sleep(400); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public void exter_shutter_trigger_sec(double s) throws InterruptedException { try { shutter_trigger.prepare(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } int x = (int) ((s * 1000.0) / 100.0); for (int i = 0; i < x; i++) { // activity:message_inf(i,"第%03d張拍攝完成"); shutter_trigger.start(); while (shutter_trigger.isPlaying()) Thread.sleep(1); } }
public void onPictureTaken(byte[] data, Camera camera) { long time = System.currentTimeMillis(); Date date = new Date(time); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmssSSS"); // ( (TextView)findViewById( R.id.save_file ) ).setText("檔案寫入 : " + sdf.format(date) // +".jpg 中..." ); // ( (TextView)findViewById( R.id.save_file ) ).requestLayout(); try { Thread.sleep(1000); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } String path = "/sdcard/ez_Lua_Script_Camera/DCIM/" + sdf.format(date) + ".jpg"; File file = new File(path); try { file.createNewFile(); OutputStream os2 = new BufferedOutputStream(new FileOutputStream(file), 8192); os2.write(data); os2.close(); ((TextView) findViewById(R.id.save_file)) .setText("檔案寫入 : " + sdf.format(date) + ".jpg 完成"); all_pics++; ((TextView) findViewById(R.id.shutter_times_screen)) .setText("拍攝張數 : " + String.format("%05d", all_pics)); } catch (IOException e) { } synchronized (semaphore) { semaphore.notify(); } }