I have a problem, get the Android Studio Navigation Drawer Layout to do my project, however when I want to call the camera class error.
I created another class for the camera, where I have GPS and where the image will be stored.
public class Camera extends Principal
{
private AlertDialog alerta;
public static final int IMAGEM_INTERNA = 1313;
public void Tirafoto (View view)
{
LocationManager locationManager = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
final boolean GPSEnabled = locationManager.isProviderEnabled
(LocationManager.GPS_PROVIDER);
if (GPSEnabled) {
Intent camera = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(camera, IMAGEM_INTERNA);
} else {
AlertDialog.Builder alertas = new AlertDialog.Builder(this);
alertas.setTitle("Ligar GPS");
alertas.setMessage("Para usar essa função você deve ativar seu GPS");
alertas.setPositiveButton("Ativar GPS", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
}
});
alertas.setNegativeButton("Não Ligar", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
Toast.makeText(Camera.this, "Camera disponivel somente com o
uso do GPS=" + arg1, Toast.LENGTH_SHORT).show();
}
});
alerta = alertas.create();
alerta.show();
}
}
}
And in the main Activity I have
if (id == R.id.nav_camera) {
Camera camera = new Camera();
I do not know how to continue because I tried in several ways but could not make it work.