簡體   English   中英

Android應用程序中的SimpleExpandableListAdapter問題

[英]SimpleExpandableListAdapter issue in android application

我嘗試將源代碼從android 2傳遞到android4。該代碼不會提示我錯誤,並且應用程序啟動。 但是開始時有一個登錄名。 當我單擊“登錄”時,應用程序崩潰。 日志消息顯示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
        ) 

日志貓:

在此處輸入圖片說明

您是否認為問題是代碼太舊了? 現在, SimpleExpandableListAdapter的結構有所不同嗎? 我要改變什么?

Context參數_ContactScreen_objectnull 這是SimpleExpandableListAdapter.java的第210行:

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

您的代碼需要更多上下文才能提供進一步的幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM