I have recently picked up a project from a few months ago. Went to re-open the project and found a few of the following errors:
public void onCreate(Bundle savedInstanceState) {
Gives the error: The method onCreate(Bundle) of type myMain must override or implement a supertype method
super.onCreate(savedInstanceState);
setContentView(R.layout.splashscreen);
Gives the errors: The method onCreate(Bundle) is undefined for the type Activity and The method onCreate(Bundle) is undefined for the type Activity.
@Override
protected void onPause() {
Gives the error: The method onPause() of type myMain must override or implement a supertype method
I have created a new project with identical code for the first section (see code block 2) and do not receive any errors. I am certain it is a small config/code change I cannot pin down that will solve all these problems in one sweep.
Full code is: package com.myapp.app;
import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
public class myMain extends Activity {
MediaPlayer mpSplash;
@Override
// onCreate works like in the activity diagram from tutorial.
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splashscreen);
mpSplash = MediaPlayer.create(this, R.raw.logo_noise);
mpSplash.start();
Thread logoTimer = new Thread()
{
public void run()
{
try{
int logoTimer = 0;
while(logoTimer < 2000)
{
sleep(100);
logoTimer = logoTimer +100;
}
startActivity(new Intent ("com.myapp.app.CLEARSCREEN"));
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
finish(); // shut down class
}
}
};
logoTimer.start();
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
mpSplash.release();
}
@Override
protected void onRestart() {
// TODO Auto-generated method stub
super.onRestart();
mpSplash.pause();
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
mpSplash.start();
}
@Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
}
}
CODE BLOCK 2
import android.app.Activity;
import android.os.Bundle;
public class myMain extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
I have searched around and found mainly overly complex and unrelated issues such as: import of android.r Updating the build path Re-importing the project creating new references to classes. Configuring proguard? None of the above have seemed to work.
Any help that anyone could provide on this issue would be greatly appreciated.