Android SharedPreferences到getInt

时间:2013-08-23 17:37:47

标签: android sharedpreferences

我正在使用SharedPreferences来获取“年龄”,但遇到以下错误......如何处理?谢谢!

SharedPreferences settings3 = Profile.this.getSharedPreferences("MyApp",0);
age = settings3.getInt("age",25);
textview_age_input.setText(""+age);  //LINE 122

的logcat:

08-24 01:23:59.588: E/AndroidRuntime(15117): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0xa0
08-24 01:23:59.588: E/AndroidRuntime(15117):    at android.content.res.Resources.getText(Resources.java:242)
08-24 01:23:59.588: E/AndroidRuntime(15117):    at android.widget.TextView.setText(TextView.java:3806)
08-24 01:23:59.588: E/AndroidRuntime(15117):    at com.abc.abc.Profile.onCreate(Profile.java:122)
08-24 01:23:59.588: E/AndroidRuntime(15117):    at android.app.Activity.performCreate(Activity.java:5206)

0 个答案:

没有答案