I am making a game for both android and pc, and have to import stuff exclusive to android along with write methods containing code that only works with android
I want to be able to do something like this, so in the case of me compiling for a non-android version, it wont give compile errors
boolean android = "The Android Project".equals(System.getProperty("java.specification.vendor"));
void setup(){
if (android)
importAndroid();
//other setup stuff irrelevant to the question
}
void importAndroid(){
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.content.Context;
import android.app.Activity;
}