I have this code to make some treatement when an option from ListPreference is selected:
choice = prefs.getString("listPref_kernel", "0");
if (choice == "0") {
try {
File sdCard = Environment.getExternalStorageDirectory();
File dir = new File (sdCard.getAbsolutePath() + "/jetpack/install");
dir.mkdirs();
File file = new File(dir, "talondev");
FileOutputStream f = new FileOutputStream(file);
}
catch (Exception e) {
Log.d("Excep_ERROR", e.getMessage());
}
}
Just after this instruction: if (choice == "0")
nothing is executed, i put a toast and it’s not showen after that instruction but before it yes.
XML FILE:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="kernel">
<item>TalonDev</item>
<item>Semaphore</item>
<item>SpeedMod</item>
<item>Galaxian</item>
</string-array>
<string-array name="kernel_return">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
</resources>
Any idea please? Thank you very much.
If it is truely String instance then try to
if(Integer.valueOf(choice) == 0)