-1

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 {
1621656
  • 47
  • 2
  • 5
  • Post more code. The line it tells you isn't necessarily the line the actual error is on. I'm guessing you're missing it on the line (or expression) above this code. – Carcigenicate Jan 30 '17 at 13:45
  • FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) implements DialogInterface.OnClickListener { View view = null; Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); – 1621656 Jan 30 '17 at 14:50
  • You should correct your question tags, this is java i presume. – ngeksyo Jan 30 '17 at 14:52
  • yes, it's java. sorry about not saying. – 1621656 Jan 30 '17 at 14:57

1 Answers1

0

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) {
      ...
   }
}
AlexZam
  • 1,147
  • 7
  • 18