Why can't I override onConfigurationChanged?

android, java

Solution

Have you got `android.content.res.Configuration` in your import statements? Eclipse can insert imports automatically if you press Ctrl+Shift+O.

If that's missing, the compiler will be unable to recognise that you're legitimately overriding the superclass method and so will throw an error.

Problem

I'm trying to override the method onConfigurationChanged and I get the error: The method onConfigurationChanged(Configuration) of type BaseActivity must override or implement a supertype method Here is my BaseActivity.java: ``` import android.app.Activity; import android.content.Intent; import android.view.View; import android.view.View.OnClickListener; public class BaseActivity extends Activity { protected View.OnClickListener mButtonListenerUPP; protected View.OnClickListener mButtonListenerALT; protected View.OnClickListener mButtonListenerNAV; protected View.OnClickListener mButtonListenerHIS; @Override public void setContentView(int layoutResID) { super.setContentView(layoutResID); } @Override public void onConfigurationChanged(Configuration newConfig) { setContentView(R.layout.main); } } ``` A lot of posts on the Internet are saying that I can override this method... Any ideas?

Original source

Related problems