Listview.setadapter raising nullpointer exception

前端 未结 4 1843
悲&欢浪女
悲&欢浪女 2021-01-23 06:09

The code is as below

    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent i = getIntent();

        ArrayLis         


        
相关标签:
4条回答
  • 2021-01-23 06:15

    put this line after the super.onCreate(savedInstanceState);

    setContentView(R.layout.company_list);
    
    0 讨论(0)
  • 2021-01-23 06:28

    what is this ?

     UrlList urlList;
     urlList = XMLParser.urlList;
    

    and what is it doing here?

    String[] categoryNameStrings = urlList.getCategoryName().toArray(new String[0]);
    

    Can you please post the error log?

    0 讨论(0)
  • 2021-01-23 06:39

    Use setContentView(R.layout.company_list);aftersuper.onCreate(savedInstanceState);

    0 讨论(0)
  • 2021-01-23 06:39

    when getting error like this first need to ensure that have given correct xml file as

    setContentView(R.layout.main) and

    listview id (i.e) findViewById(R.id.listview1);

    0 讨论(0)
提交回复
热议问题