I'm making App with Android Studio.
I have a
public class MainActivity extends Activity implements View.OnClickListener, OnCheckedChangeListener
And I need to add "AppCompatActivity" to the MainActivity.
I have searched on the Internet and I found only one can be used for extends.
So I Changed to
public class MainActivity extends Activity implements View.OnClickListener, OnCheckedChangeListener, AppCompatActivity
This and AppCompatActivity has an error that "Interface expected here".
How can I solve this problem?
The AppCompatActivity
is a class not an interface so you can't use implements
keyword to inherit the AppCompatActivity
You need to use extends
keyword to inherit the AppCompatActivity
class
Use this
public class MainActivity extends AppCompatActivity implements View.OnClickListener, OnCheckedChangeListener
instead of
public class MainActivity extends Activity implements View.OnClickListener, OnCheckedChangeListener, AppCompatActivity