@Override public void onLocationChanged(Location loc) { if (fgGPSActif) { double latitude = -1000; double longitude = -1000; latitude = loc.getLatitude(); longitude = loc.getLongitude(); // if (Params.TAG_FG_DEBUG && fgDebugLocal){Log.i(Params.TAG_GEN, TAG_LOCAL + "latitude = " + // latitude);}; // if (Params.TAG_FG_DEBUG && fgDebugLocal){Log.i(Params.TAG_GEN, TAG_LOCAL + "longitude = " + // longitude);}; DecimalFormat dec = new DecimalFormat("#.0000"); drawViewGPS.setLat("Lat : " + dec.format(latitude) + "°"); drawViewGPS.setLong("Long : " + dec.format(longitude) + "°"); drawViewGPS.invalidate(); } }
private void activeCamera() { camera = getCameraInstance(); try { if (camera != null) { frameLayout = new FrameLayout(this); frameLayout.setLayoutParams( new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); // Create a new camera view and add it to the layout preview = new Preview(this, camera); frameLayout.addView(preview); // Create a new draw view and add it to the layout drawViewGPS = new DrawViewGPS(this, "", "", fgGPSActif); drawViewGPS.setScreen(screenPoint); drawViewGPS.setLat(strLat); drawViewGPS.setLong(strLong); frameLayout.addView(drawViewGPS); // Set the layout as the apps content view setContentView(frameLayout); } else { Toast toast = Toast.makeText( getApplicationContext(), "Unable to find camera. Closing.", Toast.LENGTH_SHORT); toast.show(); finish(); } } catch (Exception e) { if (Params.TAG_FG_DEBUG && fgDebugLocal) { Log.i(Params.TAG_GEN, TAG_LOCAL + "Load error = " + e.getMessage()); } ; if (camera != null) { camera.release(); camera = null; } } }