I am making a game for both android and pc, and have to import stuff exclusive for 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
//if (android) {
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.content.Context;
import android.app.Activity;
//}
Along with a way to have methods that use said exclusive imports to be ignored when not compiling for android
//only compile when android
void saveInt(int n, String name) {
SharedPreferences sharedPreferences;
SharedPreferences.Editor editor;
//~~stuff not necessary for example~~
}
Is this possible or will I just have to comment out all of the code that does not apply manually every time?