我尝试使用GridView,但Android Studio会通知此错误

时间:2016-10-13 16:57:54

标签: android-runtime

E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.example.admin.myapp_withgridview, PID: 2856
                  android.content.res.Resources$NotFoundException: String resource ID #0x5d75c80
                      at android.content.res.Resources.getText(Resources.java:299)
                      at android.support.v7.widget.ResourcesWrapper.getText(ResourcesWrapper.java:52)
                      at android.widget.TextView.setText(TextView.java:4132)
                      at com.example.admin.myapp_withgridview.CustomAdapter.getView(CustomAdapter.java:57)
                      at android.widget.AbsListView.obtainView(AbsListView.java:2347)
                      at android.widget.GridView.onMeasure(GridView.java:1060)
                      at android.view.View.measure(View.java:17547)
                      at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:727)
                      at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:463)
                      at android.view.View.measure(View.java:17547)
                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
                      at android.widget.FrameLayout.onMeasure(FrameLayout.java:436)
                      at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
                      at android.view.View.measure(View.java:17547)
                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
                      at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:389)
                      at android.view.View.measure(View.java:17547)
                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
                      at android.widget.FrameLayout.onMeasure(FrameLayout.java:436)
                      at android.view.View.measure(View.java:17547)
                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
                      at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
                      at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
                      at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
                      at android.view.View.measure(View.java:17547)
                      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5535)
                      at android.widget.FrameLayout.onMeasure(FrameLayout.java:436)
                      at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2615)
                      at android.view.View.measure(View.java:17547)
                      at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2015)
                      at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1173)
                      at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1379)
                      at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)
                      at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5885)
                      at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
                      at android.view.Choreographer.doCallbacks(Choreographer.java:580)
                      at android.view.Choreographer.doFrame(Choreographer.java:550)
                      at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
                      at android.os.Handler.handleCallback(Handler.java:739)
                      at android.os.Handler.dispatchMessage(Handler.java:95)
                      at android.os.Looper.loop(Looper.java:135)
                      at android.app.ActivityThread.main(ActivityThread.java:5254)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at java.lang.reflect.Method.invoke(Method.java:372)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Application terminated.

1 个答案:

答案 0 :(得分:0)

此错误有许多不同的可能原因。如果您提供示例源代码,则可能会得到更好的响应。

与此同时,this thread看起来对可能的原因有很好的了解。