简体   繁体   中英

Keep getting error: ';' expected

I keep getting this error "Error:(28, 43) error: ';' expected".

This is the code line where the error is:

            public void onClick(View view) implements DialogInterface.OnClickListener {

It is illegal statement for sure.

public void onClick(View view) states that you define some method. But implements DialogInterface.OnClickListener can be included in class/interface definition only. (Like class A implements B ).

If you are making listener, do this:

class MyListener implements DialogInterface.OnClickListener {
   public void onClick(View view) {
      ...
   }
}

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