首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不能将ExpandableListAdapter解析为类型

不能将ExpandableListAdapter解析为类型
EN

Stack Overflow用户
提问于 2014-01-24 20:10:03
回答 1查看 1.4K关注 0票数 0

我已经在我的另一个android应用程序上做了这个,它运行得完美无缺,但是当我在另一个应用程序中这样做时,它就不工作了。

我一直收到一个错误:"ExpandableListAdapter不能解析为类型“

代码语言:javascript
复制
public class MainActivity extends Activity implements AdListener,
        OnClickListener {

    ExpandableListAdapter listAdap;
    ExpandableListView expListView;
    List<String> listDataHeader;
    HashMap<String, List<String>> listDataChild;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Full Screen
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_main);

        // get the list view
        expListView = (ExpandableListView) findViewById(R.id.lvExp);
        prepareListData();
        listAdap = new ExpandableListAdapter(this, listDataHeader, listDataChild);

        // setting list adapter, show the list
        expListView.setAdapter(listAdap);

        expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {

                    public boolean onChildClick(ExpandableListView parent,
                            View v, int groupPosition, int childPosition,
                            long id) {
                    }
                });
    }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-01-24 20:14:20

ExpandableListAdapter是一个接口,不能实例化。如果您需要更多的灵活性,则应该使用SimpleExpandableListAdapterextends BaseExpandableListAdapter,并重写其方法。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21341600

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档