Crash after adding footer to ListView

会有一股神秘感。 提交于 2019-12-05 08:36:23
  1. Change

    getListView().addView(footerView);
    

    To

    getListView().addFooterView(footerView);
    
  2. Explanation for inflate function:

    LayoutInflater().inflate() just converts a layout xml into an actual View structure.

  3. Your second issue:

    Have a look at your click listener:

    Intent startNewActivity = new Intent(null, AddToDoActivity.class);
    

    You cannot start an Intent with null as the context (the first argument)

    Change to this:

    Intent startNewActivity = new Intent(ToDoManagerActivity.this, AddToDoActivity.class);
    

short explanation of inflate method: Instantiates a layout XML file into its corresponding View objects. see LayoutInflator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!