Created
October 25, 2011 20:26
-
-
Save skyler/1314154 to your computer and use it in GitHub Desktop.
launching the GS app with an intent & extra
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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