Skip to content Skip to sidebar Skip to footer

Positing In Android Using Indooratlas

I am trying to draw a circle for getting positing stuff work but I don't have any luck, I am using android canvas here is my method- public void onServiceUpdate(ServiceState st

Solution 1:

Here is my complete code. It might works for you too. Just edit a little necessary in your declaration.

public void onServiceUpdate(ServiceState state) {
    log("onServiceUpdate");
    mSharedBuilder.setLength(0);
    mSharedBuilder.append("Location: ")
            .append("\n\tPing : ").append(state.getRoundtrip()).append("ms")
            .append("\n\tLatitude : ").append(state.getGeoPoint().getLatitude())
            .append("\n\tLongitude : ").append(state.getGeoPoint().getLongitude())
            .append("\n\tX [meter] : ").append(state.getMetricPoint().getX())
            .append("\n\tY [meter] : ").append(state.getMetricPoint().getY())
            .append("\n\tI [pixel] : ").append(state.getImagePoint().getI())
            .append("\n\tJ [pixel] : ").append(state.getImagePoint().getJ())
            .append("\n\tHeading : ").append(state.getHeadingDegrees())
            .append("\n\tUncertainty: ").append(state.getUncertainty());

    log(mSharedBuilder.toString());
        final int i, j;
        i = state.getImagePoint().getI();
        j = state.getImagePoint().getJ();
        ImageView imageView = (ImageView) findViewById(R.id.imageView);
        imageView.buildDrawingCache();
        Bitmap bitmap = imageView.getDrawingCache();
        final ImageView imageFloor = (ImageView) findViewById(R.id.imageView);
        final Bitmap bitmapCircle = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), bitmap.getConfig());
        Canvas canvas = new Canvas(bitmapCircle);
        Paint paint = new Paint();
        paint.setAntiAlias(true);
        paint.setColor(Color.BLUE);
        paint.setStrokeWidth(10);
        canvas.drawBitmap(bitmap, new Matrix(), null);
        canvas.drawCircle(i, j, 10, paint);
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                imageFloor.setImageBitmap(bitmapCircle);
            }
        });

Post a Comment for "Positing In Android Using Indooratlas"