Er... the onStart() method takes Intent as a parameter, so that is what
your onStart() method should be taking. This code looks like it was from a
pre-1.0 version of the platform (and whoever wrote it didn't use @Override,
naughty naughty!).
On Tue, Nov 25, 2008 at 3:09 PM, steve_macleod
<[EMAIL PROTECTED]>wrote:
>
> Hi,
> Quick question, I am running a service (code below). I have a problem
> with the super.onStart(intent, startId) line. The onStart call expects
> and Intent as paremeter. How can I get this from the context below?
>
> Thanks
>
> package com.stevemacleod.prankapp;
>
> import java.io.IOException;
>
> import android.app.Service;
> import android.content.Context;
> import android.content.Intent;
> import android.media.MediaPlayer;
> import android.os.Bundle;
> import android.os.IBinder;
>
> public class PrankService extends Service
> {
> MediaPlayer player = null;
> String str;
> public IBinder onBind(Intent intent)
> {
> return null;
> }
>
> public void onStart(int startId, Bundle arguments)
> {
> super.onStart(intent, startId);
> player = MediaPlayer.create((Context)this,
> R.raw.groove_arm);
> player.start();
>
> }
> public void onDestroy()
> {
> super.onDestroy();
> player.stop();
> }
>
> }
>
> >
>
--
Dianne Hackborn
Android framework engineer
[EMAIL PROTECTED]
Note: please don't send private questions to me, as I don't have time to
provide private support. All such questions should be posted on public
forums, where I and others can see and answer them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---