how can i pass a string from activity to Service in Android?
<p>Can anyone tell how to pass an String or integer whatever, from activity to Service.
im trying to pas an integer setpossition(4), but it doesnt take, always it takes 0 Service when it start I dont know why i cant manipulate from Activity by using an instance of Service.</p>

<pre><code>    public class MainMP3 extends Activity{
Button play,stop,prev,next,list;

static final String MEDIA_PATH = new String("/sdcard/");
 Activity main_activity;

@Override
public void onCreate(Bundle savedInstanceState) {
    main_activity=this;
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mp3interface);


    play= (Button) findViewById(R.id.play);
    stop= (Button) findViewById(R.id.stop);
    prev= (Button) findViewById(R.id.prev);
    next= (Button) findViewById(R.id.next);
    list= (Button) findViewById(R.id.listofsongs);


    play.setOnClickListener(new StartClick());  

    stop.setOnClickListener(new StopClick());  

    prev.setOnClickListener(new PullClick());  





    next.setOnClickListener(new View.OnClickListener() {

        @Override                           
        public void onClick(View v) {


        }
    });


    list.setOnClickListener(new View.OnClickListener() {

        @Override                           
        public void onClick(View v) {

            Intent i= new Intent(MainMP3.this,songlist.class);
            startActivity(i);

        }
    });

}




  ServiceMP3 service = null;

  ServiceConnection connection = new ServiceConnection() {

        @Override  // Called when connection is made
        public void onServiceConnected(ComponentName cName, IBinder binder) {
            service = ((ServiceMP3.SlowBinder)binder).getService();
        }
        @Override   //
        public void onServiceDisconnected(ComponentName cName) {
            service = null;
        }
    };


    private class StartClick implements View.OnClickListener {      
        public void onClick(View v) {
            Intent intent = new Intent(main_activity,ServiceMP3.class);
            service.setposition(4);
            main_activity.startService(intent);



        }
    }

    private class StopClick implements View.OnClickListener {       
        public void onClick(View v) {
            Intent intent = new Intent(main_activity,ServiceMP3.class);
            main_activity.stopService(intent);

        }
    }


    private class PullClick implements View.OnClickListener {       
        public void onClick(View v) {



        }
    }


        }
</code></pre>
