简体   繁体   English

Android应用程序中的SimpleExpandableListAdapter问题

[英]SimpleExpandableListAdapter issue in android application

I try to change a source code passing from android 2 to android 4.. The code doesn't gets me error and the application starts. 我尝试将源代码从android 2传递到android4。该代码不会提示我错误,并且应用程序启动。 But at the beginning there is a login. 但是开始时有一个登录名。 When i click on "Login" the app crashes. 当我单击“登录”时,应用程序崩溃。 The logcat displays that there is a problem with SimpleExpandableListAdapter . 日志消息显示SimpleExpandableListAdapter存在问题。 this is the part of code that use the SimpleExpandableListAdapter: 这是使用SimpleExpandableListAdapter的代码的一部分:

expListAdapter = new SimpleExpandableListAdapter(_ContactScreen_object,
                _groupSections, // groupData describes the first-level entries
                R.layout.group_row, // Layout for the first-level entries
                new String[] { "sectionName" }, // Key in the groupData maps to
                // display
                new int[] { R.id.groupname }, // Data under "friendName" key
                // goes into this TextView
                _result, // childData describes second-level entries
                R.layout.child_row, // Layout for second-level entries
                new String[] { "friendName", "status" }, // Keys in childData
                // maps to display
                new int[] { R.id.childname, R.id.rgb } // Data under the keys
        // above go into these
        // TextViews
        ) 

logcat: 日志猫:

在此处输入图片说明

Do you think that the problem is the code is old? 您是否认为问题是代码太旧了? The structure of SimpleExpandableListAdapter is different now? 现在, SimpleExpandableListAdapter的结构有所不同吗? What have i to change? 我要改变什么?

The Context param _ContactScreen_object is null . Context参数_ContactScreen_objectnull Here's line 210 of SimpleExpandableListAdapter.java : 这是SimpleExpandableListAdapter.java的第210行:

mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

More context (sic) of your code needed to provide further help. 您的代码需要更多上下文才能提供进一步的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM