1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| public class EV extends Activity implements OnClickListener{
TextView txtExpValue;
Button btnExpValue;
LinearLayout layoutMain;
Camera camera;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
txtExpValue = new TextView(this);
btnExpValue = new Button(this);
layoutMain = new LinearLayout(this);
txtExpValue.setText("EV");
btnExpValue.setText("Mesurer");
layoutMain.addView(txtExpValue);
layoutMain.addView(btnExpValue);
btnExpValue.setOnClickListener(this);
setContentView(layoutMain);
}
@Override
public void onClick(View arg0) {
try{
if (camera == null){
camera = Camera.open();
}
if (camera != null){
int ExpComp = camera.getParameters().getExposureCompensation();
float ExpCompStep = camera.getParameters().getExposureCompensationStep();
float EV = (float) (ExpComp*ExpCompStep);
txtExpValue.setText(""+EV);
}
}
catch (Exception e) {
txtExpValue.setText("BugVersion");
e.printStackTrace();
}
}
} |
Partager