Buen día tengo el siguiente conflicto, tengo dos archivos mi GeofenceIntentService.java
y mi BaseActivityHelper.java
Deseo llamar desde mi GeofenceInt...
un metodo que tengo en mi BaseActiv...
GeofenceIntentService.java:
@Override
protected void onHandleIntent(Intent intent) {
if (intent.getBooleanExtra(FORZAR_NOTIFICACION, false)) {
procesarTriggeringGeofences(null);
mostrarNotificacionDirec();
dialogDirec();
return;
}
GeofencingEvent geofencingEvent = GeofencingEvent.fromIntent(intent);
if (geofencingEvent.hasError()) {
Log.e(TAG_LOG, GeofenceStatusCodes.getStatusCodeString(geofencingEvent.getErrorCode()));
return;
}
// Get the transition type.
int geofenceTransition = geofencingEvent.getGeofenceTransition();
// Test that the reported transition was of interest.
if (geofenceTransition == Geofence.GEOFENCE_TRANSITION_EXIT) {
List<Geofence> triggeringGeofences = geofencingEvent.getTriggeringGeofences();
procesarTriggeringGeofences(triggeringGeofences);
mostrarNotificacionDirec();
dialogDirec();
} else {
Log.e(TAG_LOG, String.format("Código no soportado de transicion de Geofence %s",
geofenceTransition));
}
}
private void dialogDirec() {
BaseActivityHelper BAH = new BaseActivityHelper();
BAH.salirPdvDialog();
}
y:
BaseActivityHelper.java:
@ContextSingleton
public class BaseActivityHelper {
public void salirPdvDialog() {
AlertDialog.Builder builderr = new AlertDialog.Builder(mActivity, R.style.StyledDialog);
builderr.setTitle(R.string.confirmacion_salida_pdv_dir)
.setMessage(R.string.saliendo_de_punto_dirr)
.setCancelable(false);
AlertDialog dialog = builderr.create();
dialog.show();
}
}
Tengo el siguiente Error:
FATAL EXCEPTION: IntentService[GeofenceIntentService]
Process: com.android.app, PID: 25724
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference