I am currently working on a code that I need to convert from 'extends Activity' to 'extends Service'. I need this because I need to have my app running (the audio being played) in the background even if the phone is in sleep mode. However, doing so caused me some errors. I have no idea how to fix this. As recommended by eclipse, I removed '@Override' before 'protected void onCreate...'. But it still has some errors with functions under it.
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_p_3);
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
p_e=0;
second_display=(TextView)findViewById(R.id.textView1);
minute_display=(TextView)findViewById(R.id.textView2);
hour_display=(TextView)findViewById(R.id.textView3);
The ones I am having problems with are:
requestWindowFeature
onCreate
setContentView
setRequestedOrientation
findViewById
finish(); (from another child class)
Are there equivalent codes in Activity that I can use in Service?
How do I fix these? I really need help.