package com.godoro.androiddevices;
import android.app.*;
import android.content.pm.*;
import android.hardware.*;
import android.os.*;
import android.widget.*;
public class SensorListActivity extends Activity{
private TextView textView;
private SensorManager sensorManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sensor_list);
textView=(TextView) findViewById(R.id.textView);
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
for(Sensor sensor : sensorManager.getSensorList(Sensor.TYPE_ALL)){
textView.append(sensor.getName()+"\r\n");
}
boolean gyroscopyExists = getPackageManager().hasSystemFeature(PackageManager.FEATURE_SENSOR_GYROSCOPE);
textView.append("gyroscopyExists: "+gyroscopyExists+"\r\n");
Sensor orientationSensor=sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
textView.append("orientationSensor: "+(orientationSensor!=null?"not null":"null")+"\r\n");
}
}
Dosyayı İndir