Ausnahme ist: java.lang.NullPointerException: Versuch, die Schnittstellenmethode „void ant.co.in.geotagginglibraryLocationApp.GeoLocationPopup$OnCameraClickedListener.capture()“ aufzurufen auf einer Nullobjektreferenz
bei anant.co.in.geotagginglibraryLocationApp.GeoLocationPopup$1.onClick(GeoLocationPopup.java:183)
Ich füge den Code bei, bitte helfen Sie bei der Lösung .
Code: Select all
addlocation.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
addlocation.setEnabled(false);
if (!showValidations(context)) {
onCameraClickedListener.capture();
addlocation.setEnabled(true);
}
addlocation.setEnabled(true);
}
});
private void openCamera() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) {
File photoFile = null;
try {
photoFile = imageUtils.createImageFile(PREFIX_GEO_TAG_IMG);
} catch (IOException ex) {
ex.printStackTrace();
}
if (photoFile != null) {
imagePath = photoFile.getAbsolutePath();
Uri photoURI = FileProvider.getUriForFile(getActivity(), "anant.co.in.geotagginglibraryAculife.FileProvider", photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
startActivityForResult(takePictureIntent, REQUEST_CAPTURE_IMAGE);
}
}
}
doctortag.setOnCameraClickedListener(new GeoLocationPopup.OnCameraClickedListener() {
@Override
public void capture() {
openCamera();
}
});