Skip to content

Instantly share code, notes, and snippets.

@skyler
Created October 25, 2011 20:26
Show Gist options
  • Save skyler/1314154 to your computer and use it in GitHub Desktop.
Save skyler/1314154 to your computer and use it in GitHub Desktop.
launching the GS app with an intent & extra
package com.grooveshark.extratest;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class ExtraTestActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final EditText text = (EditText) findViewById(R.id.song_id_field);
((Button) findViewById(R.id.launch_button)).setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v)
{
long songId = Long.parseLong(text.getText().toString());
android.util.Log.d("ExtraTestActivity", "songId is" + songId);
Intent i = new Intent("com.grooveshark.android.action.VIEW_SONG");
i.putExtra("songId", songId);
startActivity(i);
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment