B4X:
#If Java
import android.content.Context;
import android.content.SharedPreferences;
private static String uniqueID = null;
private static final String PREF_UNIQUE_ID = "PREF_UNIQUE_ID";
public synchronized static String id(Context context) {
if (uniqueID == null) {
SharedPreferences sharedPrefs = context.getSharedPreferences(
PREF_UNIQUE_ID, Context.MODE_PRIVATE);
uniqueID = sharedPrefs.getString(PREF_UNIQUE_ID, null);
if (uniqueID == null) {
uniqueID = UUID.randomUUID().toString();
Editor editor = sharedPrefs.edit();
editor.putString(PREF_UNIQUE_ID, uniqueID);
editor.commit();
}
}
return uniqueID;
}
#End If
when i compile the above java code i got this compilation error
Compiling generated Java code. Error
src\mid\collsb\main.java:820: error: cannot find symbol
Editor editor = sharedPrefs.edit();
^
symbol: class Editor
location: class main
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
javac 11.0.1
what i am doing wrong ?