user1493570
user1493570

Reputation: 127

android developer training errors in sample code for network connection

I am going through the android developer training material here - http://developer.android.com/training/basics/network-ops/index.html. I downloaded the sample code NetworkUsage.zip and imported it to eclipse. The code has error in SettingsActivity.java when I open it, "The method onSharedPreferenceChanged(SharedPreferences, String) of type SettingsActivity must override a superclass method".

As far as I can see it is correctly defining the method and implementing the interface, why is there an error? From the android api I can see that this interface still exists and has not be deprecated or anything.

Thanks!

Upvotes: 1

Views: 981

Answers (1)

Dheeresh Singh
Dheeresh Singh

Reputation: 15701

not sure but may it help

'Must Override a Superclass Method' Errors after importing a project into Eclipse

Eclipse is defaulting to Java 1.5 and you have classes implementing interface methods (which in Java 1.6 can be annotated with @Override, but in Java 1.5 can only be applied to methods overriding a superclass method).

Go to your project/ide preferences and set the java compiler level to 1.6 and also make sure you select JRE 1.6 to execute your program from eclipse.

Why do I get "must override a superclass method" with @Override?

Upvotes: 3

Related Questions