Tuesday:
Accelerometer.zip
Emulator Rotation
temp.zip (Temperature Sensor
The first example above has a line
in onCreate about registering a listener
that might make it more stable.
senSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
senAccelerometer = senSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
senSensorManager.registerListener(this, senAccelerometer , SensorManager.SENSOR_DELAY_NORMAL);
Sensor Lab
Make an app with a temperature and relative humidity sensor. Convert the
temperature to Fahrenheit. Display the temperature and relative humidity.
And then determine if each is in an ideal, acceptable or not acceptable.
Ideal temperatures range from 68 to 72; acceptable temperatures from
66 to 74. Ideal relative humidity ranges from 41% to 49%; acceptable relative humidity
ranges from 37% to 53%.
(https://www.si.edu/mci/downloads/reports/Mecklenburg-Part1-RH.pdf)
Dealing with multiple sensors:
https://stackoverflow.com/questions/4343342/is-there-a-way-to-retrieve-multiple-sensor-data-in-android?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
@Override
public void onSensorChanged(SensorEvent event) {
Sensor sensor = event.sensor;
if (sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
//TODO: get values
}else if (sensor.getType() == Sensor.TYPE_ORIENTATION) {
//TODO: get values
}
}
Due: May 1
Project Start working on an idea for a project App.
- It cannot be what you are doing for another course.
- It must have at least two tabs.
- It should include data from a file or files(JSON, XML, CSV or if it is simple text have multiple files.)
- Something, data or image or youtube video, must be obtained dynamically from the web (e.g. use an API or
use an image from the web).
- In addition to spinner and button (which you must have), you must get some input from the user in two
other ways (e.g. EditText, Checkbox, RadioButton, SeekBar, etc). And you must do something with that
input.
- There should be logic -- unique to your app -- like a calculation or some game logic --
not just a repeat of a lab already done.
- It should incorporate a Shared Preference (remember something from the user from one use to the next).
Due: May 4 at 11:59 PM