I will have a list of YouTube video titles and I want when the user clicks them it goes to the url.
Example: click here for this VIDEO!
thanks in advance
code::: Java::
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video);
}
private void twistUp() {
TextView twistUp = (TextView) findViewById(R.id.twistUp);
twistUp.setOnClickListener(new OnClickListener() {
@Override
Intent videoclk= new Intent(Intent.ACTION_VIEW,
Uri.parse("https://www.youtube.com/watch?v=jvO6CqtiRmo"));
startActivity(videoclk);
}
});
<TextView
android:id="@+id/twistUp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/twisted"
android:autoLink="web"
android:onClick="twistUp"
android:textAppearance="?android:attr/textAppearanceMedium" />
Make your text view clickable and inside your onClick method put: