Error: Non-static method 'findViewById(int)' cannot be referenced from a static context

后端 未结 5 1806
天命终不由人
天命终不由人 2020-12-31 05:27

I am using Android Studio (Beta), and while using this java code in \'onCreateView()\', I get an error.

ListView listView = (ListView) findViewById(R.id.some         


        
5条回答
  •  北荒
    北荒 (楼主)
    2020-12-31 06:10

    onCreateView() shouldn't be a static method (I'm assuming you are defining it within an Activity class), so you must be doing something wrong.

提交回复
热议问题