Equivalence d'un code Objective C en Android
Bonjour tout le monde,je souhaiterais connaitre l'équivalence en Android d'un code objective c :
le voici :
Code:
1 2 3 4 5
| if (deviceOrientation == UIDeviceOrientationLandscapeLeft) {
calculatedHeading = calculatedHeading + 90;
} else if (deviceOrientation == UIDeviceOrientationLandscapeRight) {
calculatedHeading = calculatedHeading + 270;
} |
Il s'agit d'une portion de code que j'aimerais implémenter dans la méthode :
Code:
1 2 3 4 5 6 7 8 9 10 11
| public void onSensorChanged(SensorEvent event) {
float vals[] = event.values;
float localDirection;
//Boussole
if(event.sensor.getType() == Sensor.TYPE_ORIENTATION){
// Check value
float tmp = vals[0];
if(tmp >= 0.0) {
...
}}} |