Hi Jason, EditText component provides setText() method with one integer indeed, but it's resource id. This means it will seek the string you defined in xml file. If the parameter you pass is not a resource id, it will occur error. Please invoke String.valueOf(tmp) or Integer.toString(int) method to convert your int to string.
NightGospel On 6月11日, 上午11時58分, Jason Hensler <[email protected]> wrote: > It seems like in my code that my app is crashing because it is a int and not > a string. This is my code: > I am assuming that tmp has a value.. For debugging what is the best way to > check varibles for values? > > If i remove the line with the red text everything runs fine. > > EditText text; > > text = (EditText) findViewById(R.id.*EditText01*); > > SharedPreferences myPrefs = *this*.getSharedPreferences("muter", * > MODE_WORLD_READABLE*); > > SharedPreferences.Editor prefsEditor = myPrefs.edit(); > > *int* tmp = myPrefs.getInt("state", 0); > > text.setText(tmp); > > Thanks in advance! > > Jason -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

