CodePudding user response:
I can do that. It's so easy. Here's how to. This is read sensor and obtain the direction of the mobile phone./* *
* Initialize the sensor manager.
*/
Private void setupSensorManager () {
MSensorManager=(SensorManager) mContext
GetSystemService (Context. SENSOR_SERVICE);
MSensorManager. RegisterListener (mSensorListener,
MSensorManager. GetDefaultSensor (Sensor. TYPE_ORIENTATION),
SensorManager. SENSOR_DELAY_NORMAL);
The d (TAG, "SensorManager setup");
}
/* *
* The sensor event listener.
*/
SensorEventListener mSensorListener=new SensorEventListener () {
@ Override
Public void onSensorChanged (SensorEvent event) {
MOrientation=event. Values [0];
The d (TAG, "Phone version" + mOrientation);
The draw (mOrientation);
}
@ Override
Public void onAccuracyChanged (Sensor, Sensor, int accuracy) {
}
};
This is the place where I really spin. I tag has been added to the map. I visit it from another class.
Public void the draw (float Angle) {
//Take the relevant Marker from the Marker list where the available in the map
AndroidMapGoogleOverlayItem myself=(AndroidMapGoogleOverlayItem) getOverlayItem (0);
If (myself==null) {
return;
}
Myself. GetMarker (.) setRotation (mOrientation);//set the orientation value returned from the senserManager
}
CodePudding user response:
Great god!!!!!
What is AndroidMapGoogleOverlayItem
CodePudding user response:
Me how I can show the location of the direction of the arrow, and Google map according to the equipment in the direction of rotation,!!!!!!!!!!CodePudding user response:
Ever bosses, with solving!!!!!! Thank you five body and kneel!!!!! Online urgent!!!!!!