Android reports an error when setting setText for textView. textviewsettext
I. My code is as follows: it is the value set by textView.
If (list! = Null) {for (Student stu: list) {// If values are assigned at once, it is incorrect TV _name.setText (stu. getName (); TV _sex.setText (stu. getSex (); TV _age.setText (stu. getAge ());}}
An error is reported:
04-04 08:56:33.950: W/ResourceType(23332): No package identifier when getting value for resource number 0x0000000c04-04 08:56:33.950: D/AndroidRuntime(23332): Shutting down VM04-04 08:56:33.950: W/dalvikvm(23332): threadid=1: thread exiting with uncaught exception (group=0x416ddd58)04-04 08:56:33.960: E/AndroidRuntime(23332): FATAL EXCEPTION: main04-04 08:56:33.960: E/AndroidRuntime(23332): Process: com.xuliugen.studentsytem, PID: 2333204-04 08:56:33.960: E/AndroidRuntime(23332): android.content.res.Resources$NotFoundException: String resource ID #0xcandroid.content.res.Resources.getText(Resources.java:252)04-04 08:56:33.960: E/AndroidRuntime(23332): at android.content.res.MiuiResources.getText(MiuiResources.java:107)04-04 08:56:33.960: E/AndroidRuntime(23332): at android.widget.TextView.setText(TextView.java:3895)04-04 08:56:33.960: E/AndroidRuntime(23332): at com.xuliugen.ui.activity.StudentManagerActivity$1.onClick(StudentManagerActivity.java:82)04-04 08:56:33.960: E/AndroidRuntime(23332): at android.view.View.performClick(View.java:4444)04-04 08:56:33.960: E/AndroidRuntime(23332): at android.view.View$PerformClick.run(View.java:18457)04-04 08:56:33.960: E/AndroidRuntime(23332): at android.os.Handler.handleCallback(Handler.java:733)04-04 08:56:33.960: E/AndroidRuntime(23332): at android.os.Handler.dispatchMessage(Handler.java:95)04-04 08:56:33.960: E/AndroidRuntime(23332): at android.os.Looper.loop(Looper.java:136)04-04 08:56:33.960: E/AndroidRuntime(23332): at android.app.ActivityThread.main(ActivityThread.java:5034)04-04 08:56:33.960: E/AndroidRuntime(23332): at java.lang.reflect.Method.invokeNative(Native Method)04-04 08:56:33.960: E/AndroidRuntime(23332): at java.lang.reflect.Method.invoke(Method.java:515)04-04 08:56:33.960: E/AndroidRuntime(23332): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:807)04-04 08:56:33.960: E/AndroidRuntime(23332): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:623)04-04 08:56:33.960: E/AndroidRuntime(23332): at dalvik.system.NativeStart.main(Native Method)
Specific solution:
If (list! = Null) {for (Student stu: list) {// If values are assigned at once, it is incorrect TV _name.setText (stu. getName () + ""); TV _sex.setText (stu. getSex () + ""); TV _age.setText (stu. getAge () + "");}}