--- android/FriendRadar/src/dk/thoerup/friendradar/RadarView.java 2009/08/15 08:58:40 266 +++ android/FriendRadar/src/dk/thoerup/friendradar/RadarView.java 2009/08/15 10:05:48 267 @@ -38,6 +38,11 @@ int heading; String headingText = "-"; + + int width; + int height; + int hcenter; + int vcenter; boolean mRun = true; @@ -87,12 +92,6 @@ } protected void myDraw(Canvas canvas) { - int w = this.getWidth(); - int h = this.getHeight(); - int hcenter = w / 2; - int vcenter = hcenter + 20; - - canvas.drawColor(0xff000000); canvas.drawLine(hcenter-5, vcenter-5, hcenter+5, vcenter+5, p); @@ -102,10 +101,10 @@ canvas.drawCircle(hcenter, vcenter+5, 115, p); canvas.drawCircle(hcenter, vcenter+5, 150, p); - canvas.drawText(distanceText1, (w-textWidth1)/2, vcenter+40+6, p3); - canvas.drawText(distanceText2, (w-textWidth2)/2, vcenter+80+6, p3); - canvas.drawText(distanceText3, (w-textWidth3)/2, vcenter+115+6, p3); - canvas.drawText(distanceText4, (w-textWidth4)/2, vcenter+150+6, p3); + canvas.drawText(distanceText1, (width-textWidth1)/2, vcenter+40+6, p3); + canvas.drawText(distanceText2, (width-textWidth2)/2, vcenter+80+6, p3); + canvas.drawText(distanceText3, (width-textWidth3)/2, vcenter+115+6, p3); + canvas.drawText(distanceText4, (width-textWidth4)/2, vcenter+150+6, p3); final float correction = 5; final float lineLength = 150; @@ -151,6 +150,12 @@ @Override public void surfaceCreated(SurfaceHolder holder) { //surfaceholder.CallBack Log.i("surfacCreated()","-"); + + width = this.getWidth(); + height = this.getHeight(); + hcenter = width / 2; + vcenter = hcenter + 20; + t.start(); } @@ -270,10 +275,6 @@ } void drawLocation(Canvas canvas, Location location) { - int w = this.getWidth(); - int h = this.getHeight(); - int hcenter = w / 2; - int vcenter = hcenter + 20; float bearing = currentLocation.bearingTo(location); float distance = currentLocation.distanceTo(location);