And for completeness for the rotation I do the following:

public void onSensorChanged(SensorEvent event) {
RideRouterApp.i(String.format("Sensor Name: %s, oriented %f", 
event.sensor.getName(), event.values[0]));
          synchronized (this) {
                mHeading = event.values[0];
                invalidate();

            }
 }

        @Override
        protected void dispatchDraw(Canvas canvas) {
            canvas.save(Canvas.MATRIX_SAVE_FLAG);
            canvas.rotate(-mHeading, getWidth() * 0.5f, getHeight() * 0.5f);
            mCanvas.delegate = canvas;
            super.dispatchDraw(mCanvas);
            canvas.restore();
            mapView.invalidate();
        }


On Thursday, April 5, 2012 11:45:45 AM UTC-4, RedBullet wrote:
>
> Like I said, it is derrived from the sample that is provided with the 
> Google API. But here is the onCreate for the activity:
>
> public void onCreate(Bundle bundle) {
> super.onCreate(bundle);
> String APIKey = "mykey";
>  mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
>      
>  // Create Rotate view
>  mRotateView = new RotateView(this);
>  RelativeLayout layout = new RelativeLayout(this);
>  RelativeLayout.LayoutParams params = new 
> RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, 
> RelativeLayout.LayoutParams.FILL_PARENT);
>  layout.setLayoutParams(params);
>  
> // create a map view
>         mapView = new MapView(this,APIKey);
> mapView.setBuiltInZoomControls(true);
> mapView.setClickable(true);
> mapView.setEnabled(true);
> mapController = mapView.getController();
> mapController.setZoom(14); // Zoom 1 is world view
>  mapView.setBuiltInZoomControls(true);
> Drawable drawable = this.getResources().getDrawable(R.drawable.pin_green);
> itemizedoverlay = new MyOverlays(drawable, this);
> layout.removeAllViews();
> mRotateView.addView(mapView);
> layout.addView(mRotateView);
>                 setContentView(layout);
> mylocation = new MyLocationOverlay(this,mapView);
> createMarker();
>
> Essentially there is a view created that manages the rotation, and it is 
> updated when the sensor changes. That all works, it rotates nicely. But 
> text on the map does not, and actually the touch layer doesn't (for example 
> if I rotate 180 degrees and then pan down it actually pans up).
>
> I am just if anyone has achieved different behavior they would be willing 
> to articulate what they did to make it work properly?
>
> On Thursday, April 5, 2012 11:37:55 AM UTC-4, TreKing wrote:
>>
>> On Thu, Apr 5, 2012 at 10:33 AM, RedBullet <> wrote:
>>
>>> I am wondering if perhaps I missed something in my implementation? Maybe 
>>> I need to invalidate a view or something?
>>
>>
>> You've provided almost no information about your implementation, so it 
>> would be quite difficult for anyone to comment on it.
>>
>>
>> -------------------------------------------------------------------------------------------------
>> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago 
>> transit tracking app for Android-powered devices
>>
>>  

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to