Wednesday, March 2, 2011

[android-developers] how to stop music which is play background in my apps

i have develope apps in which i play background music.but when i go to
the home through back tab then the song is also playing.how it is
stop.. my code are
package com.riushabh;

import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class west extends Activity implements OnClickListener {
Button bt;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
bt=(Button)findViewById(R.id.button1);
bt.setOnClickListener(this);
MediaPlayer mp=MediaPlayer.create(this, R.raw.ri);
mp.start();
}
@Override
public void onClick(View v) {
Intent i =new Intent(this,subh.class);
startActivity(i);
// TODO Auto-generated method stub

}
}

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate