StreamStarterpublic class StreamStarter extends android.app.Activity
Fields Summary |
---|
private android.content.BroadcastReceiver | mStatusListener |
Methods Summary |
---|
public void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.streamstarter);
TextView tv = (TextView) findViewById(R.id.streamloading);
Uri uri = getIntent().getData();
String msg = getString(R.string.streamloadingtext, uri.getHost());
tv.setText(msg);
| public void | onPause()
if (MusicUtils.sService != null) {
try {
// This looks a little weird (when it's not playing, stop playing)
// but it is correct. When nothing is playing, it means that this
// was paused before a connection was established, in which case
// we stop trying to connect/play.
// Otherwise, this call to onPause() was a result of the call to
// finish() above, and we should let playback continue.
if (! MusicUtils.sService.isPlaying()) {
MusicUtils.sService.stop();
}
} catch (RemoteException ex) {
}
}
unregisterReceiver(mStatusListener);
MusicUtils.unbindFromService(this);
super.onPause();
| public void | onResume()
super.onResume();
MusicUtils.bindToService(this, new ServiceConnection() {
public void onServiceConnected(ComponentName classname, IBinder obj) {
try {
IntentFilter f = new IntentFilter();
f.addAction(MediaPlaybackService.ASYNC_OPEN_COMPLETE);
registerReceiver(mStatusListener, new IntentFilter(f));
MusicUtils.sService.openfileAsync(getIntent().getData().toString());
} catch (RemoteException ex) {
}
}
public void onServiceDisconnected(ComponentName classname) {
}
});
|
|