This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get ambient temperature | |
Sensor mTemperatureSensor = sensorManager.getDefaultSensor(Sensor.TYPE_AMBIENT_TEMPERATURE); | |
if (mTemperatureSensor != null) { | |
sensorManager.registerListener(this, mTemperatureSensor, SensorManager.SENSOR_DELAY_FASTEST); | |
existTemperatureSensor = true; | |
} else { | |
existTemperatureSensor = false; | |
Toast.makeText(this, "No Temperature Sensor !", Toast.LENGTH_LONG).show(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void saveAmbientData() { | |
try { | |
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); | |
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { | |
ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, 0); | |
Location location = getLastKnownLocation(lm); | |
temp.longitude = location.getLongitude(); | |
temp.latitude = location.getLatitude(); | |
temp.altitude = location.getAltitude(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package newpackage; | |
import static org.junit.Assert.*; | |
import java.util.List; | |
import org.junit.After; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.openqa.selenium.By; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.antoniomartel; | |
import java.util.ArrayList; | |
public class FlatArray { | |
protected ArrayList nestedArray = null; | |
protected ArrayList flattenArray = null; | |
// New exception created to be thrown when nested array contains something different from Integers |