What is wrong with piece of code?
@Override
protected void onCreate(Bundle savedInstanceState) {
Eclipse states that @override cant be where it is. It says that 'Bundle' is wrong. I am lost.
What is wrong with piece of code?
@Override
protected void onCreate(Bundle savedInstanceState) {
Eclipse states that @override cant be where it is. It says that 'Bundle' is wrong. I am lost.
it should be
@Override public void onCreate(Bundle savedInstanceState){
}
onCreate
is public, not protected.
So maybe the problem is compiler compliance level: 1.5 instead of 1.6 ?
@Baleisen which level is set for your project?
What your class extends ? And which android SDK version you're compiling ?
I don't know much about the android framework but:
First make sure your class extends a Class such as (Activity) which contains onCreate. Then try to call super.onCreate, to double check that Class you are extending contains onCreate! You could be pointing to another class with the same name. Your compiler says that there is nothing to override, if you are sure it is wrong, then either your compiler is out dated or the framework.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//yourCode
}
Also if your extending and extended class, make sure, this method, I posted is in the class extending the class. It could freak out on this.
This has happened to me before and the problem was the Android SDK hadn't loaded into Eclipse fully.
Also, do you have this import in your file? The parent onCreate method is in Activity.
import android.app.Activity;