简体   繁体   中英

Cannot find symbol method FindViewById(int) with extends AppCompatActivity

I'm trying to assign a button to a Button variable using FindViewById like this:

Button dotBtn = (Button)FindViewById(R.id.dotBtn);

I get an error

Cannot find symbol method FindViewById(int)

What is the problem? Does it have something to do with the extends AppCompatActivity? I mean with this:

public class MainActivity extends AppCompatActivity

It should be findViewById not FindViewById . Small f

试试这个按钮dotBtn =(Button)findViewById(R.id.dotBtn);

It has nothing to do with AppCompatActivity. Actually it has to be : "findViewById" with small 'f' and not Capital 'F'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM