Lack of Preprocessor Workaround
in
Android Processing
•
26 days ago
Hi All, another Noob question:
I am a stuck-in-the-mud C programmer and am struggling with the lack of a preprocessor in Processing to handle different compilation conditions.
Here is the extant problem:
I have developed an Android app that uses a bunch of Android-specific imports
import android.content.Context;
import android.location.Location;
import android.location.LocationManager;
import android.location.LocationListener;
import android.location.GpsStatus.Listener;
import android.os.Bundle;
import android.location.LocationManager;
import android.location.LocationListener;
import android.location.GpsStatus.Listener;
import android.os.Bundle;
LocationManager locationManager;
MyLocationListener locationListener;
MyLocationListener locationListener;
import ketai.sensors.*;
KetaiSensor sensor;
KetaiSensor sensor;
In the land I used to inhabit, depending upon whether I was developing in Java or Android mode, I would do something like:
#ifdef ANDROIDMODE
import android.content.Context;
import android.location.Location;
import android.location.LocationManager;
import android.location.LocationListener;
import android.location.GpsStatus.Listener;
import android.os.Bundle;
import android.location.Location;
import android.location.LocationManager;
import android.location.LocationListener;
import android.location.GpsStatus.Listener;
import android.os.Bundle;
LocationManager locationManager;
MyLocationListener locationListener;
MyLocationListener locationListener;
import ketai.sensors.*;
KetaiSensor sensor;
KetaiSensor sensor;
#else
<put code here to satisfy minimum mock sensor requirements>
#endif
What is the usual Processing method to workaround the lack of a preprocessor?
and... are there globally available variable names that are defined that indicate if the mode is currently Java or Android?
thanks in advance
Joe
1