Android: get values of the Temperature Sensor, show them on the display [code] public class MainActivity extends AppCompatActivity implements SensorEventListener { private SensorManager mSM; private Sensor mTemp; private TextView sensorTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); sensorTextView = findViewById(; mSM = (SensorManager) getSystemService(SENSOR_SERVICE); mTemp = mSM.getDefaultSensor(Sensor.TYPE_AMBIENT_TEMPERATURE); } @Override public void onSensorChanged(SensorEvent sensorEvent) { float tmpval = sensorEvent.values[0]; sensorTextView.setText("Temp :" + (tmpval) ); } @Override

Android: Log or Toast the selected Item in an ListView

in case you have the need to log.i the selected item of an listview this snippet could help:   [java] listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { CheckedTextView checkedTextView = (CheckedTextView) view; String itemClicked = (String) listView.getAdapter().getItem(i); if (checkedTextView.isChecked()) { Log.i("Info :", itemClicked + " is checked");