I'm retrieving an integer value from the sharedpreferences like this:
AudioManager Am = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE);
int errorThisLine250 = prefs.getInt("adanvlm", Am.getStreamMaxVolume(AudioManager.STREAM_MUSIC));
and I'm getting this error !!!
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at android.app.SharedPreferencesImpl.getInt(SharedPreferencesImpl.java:239)
at aim.salatuna7.dialogs.AdanDialog.onCreateDialog(AdanDialog.java:250)
The starnge here is that the app was works great without any errors, today it starts showing this error whenever I show the dialog. The error is at the int errorThisLine250. Any suggestions?
Edit: I tried:
Integer.parseInt(prefs.getString("adanvlm", String.valueOf(Am.getStreamMaxVolume(AudioManager.STREAM_MUSIC))));
and it is NOT working too.