yulya3102

Untitled

Oct 4th, 2012
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. public void run() {
  2.             while (running) {
  3.                 if (holder.getSurface().isValid()) {
  4.                     long startTime = System.nanoTime();
  5.                     Canvas canvas = holder.lockCanvas();
  6.                     Thread th1 = new Thread(new Runnable() {
  7.                         public void run() {
  8.                             updateField(0, 0, width, height / 2);
  9.                         }
  10.                     });
  11.                     th1.start();
  12.                     Thread th2 = new Thread(new Runnable() {
  13.                         public void run() {
  14.                             updateField(0, height / 2, width, height);
  15.                         }
  16.                     });
  17.                     th2.start();
  18.                     try {
  19.                         th1.join();
  20.                         th2.join();
  21.                        
  22.                     }
  23.                     catch (InterruptedException e) {};
  24.                     field = field2;
  25.                     onDraw(canvas);
  26.                     holder.unlockCanvasAndPost(canvas);
  27.                     long finishTime = System.nanoTime();
  28.                     Log.i("TIME", "Circle: " + (finishTime-startTime)/1000000);
  29.                     try {
  30.                         Thread.sleep(16);
  31.                     } catch (InterruptedException ignore) {}
  32.                 }
  33.             }
  34.         }
Advertisement
Add Comment
Please, Sign In to add comment