Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void run() {
- while (running) {
- if (holder.getSurface().isValid()) {
- long startTime = System.nanoTime();
- Canvas canvas = holder.lockCanvas();
- Thread th1 = new Thread(new Runnable() {
- public void run() {
- updateField(0, 0, width, height / 2);
- }
- });
- th1.start();
- Thread th2 = new Thread(new Runnable() {
- public void run() {
- updateField(0, height / 2, width, height);
- }
- });
- th2.start();
- try {
- th1.join();
- th2.join();
- }
- catch (InterruptedException e) {};
- field = field2;
- onDraw(canvas);
- holder.unlockCanvasAndPost(canvas);
- long finishTime = System.nanoTime();
- Log.i("TIME", "Circle: " + (finishTime-startTime)/1000000);
- try {
- Thread.sleep(16);
- } catch (InterruptedException ignore) {}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment