Basically, what I want to do is have the Preview screen showing the
what the camera is currently pointing at, but I would also like to
display the changing X, Y, Z orientation of the phone. Currently I am
able to get a handle to the orientation array and its values and store
it in a Global class variable (I think code should work), but I dont
know how to display changing values on screen. I'm pretty unfamiliar
with UI's, but I want the equivalent of:
-------------------------------------------------
| |
| |
| |
| Camera Preview |
| |
| |
| |
| |
| |
| |
| |
| |
| "X Coord: " + Global.getX(); |
| "Y Coord: " + Global.getY(); |
| "Z Coord: " + Global.getZ(); |
--------------------------------------------------
Here is my code as it stands right now for setting my Global.X,
Global.Y, Global.Z variables:
public class MyCamera extends Activity{
private Preview preview;
public void capture() {
preview.capture();
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
preview = new Preview(this);
Global.setPreview(preview);
setContentView(preview);
SensorManager sens = (SensorManager) getSystemService
(Context.SENSOR_SERVICE);
MySensorListener sensListener = new MySensorListener();
sens.registerListener(sensListener, 1); // no idea what the
second
value is supposed to be, something
//
about a "bitmask", help on that would be good too.
}
private class MySensorListener implements SensorListener
{
@Override
public void onAccuracyChanged(int sensor, int accuracy) {
// TODO Auto-generated method stub
}
@Override
public void onSensorChanged(int sensor, float[] values) {
if(sensor == 1)
{
Global.setOrientation(values[0], values[1],
values[2]);
}
}
}
Any help in displaying those numbers at the bottom of the screen would
be a great help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---