• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to open a youtube video?  RSS feed

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, guys and girls, my name is Thomas, and I'm new here. I'm making an app, and I'm stuck. My app is about band Metallica, and I use Fragments.I have four fragments(About Metallica, Albums, Members and Tours).All my data are on Firebase, and I already retrieved them and all that, but my problem is with Albums.When you click on Albums a new Activity is opened and it shows Tracks of that album. My question is simple: How do I make list of Tracks clickable in order to open a Youtube video of that track?Now, I have some of the code, and I'll post it.

You don't need to go through all this code from this class. I post it just so you can see what's going on.


This is my Youtube_class. Problem is with getSupportManager(). It keeps getting red.

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayerSupportFragment;
import com.google.android.youtube.player.YouTubePlayerFragment;

import butterknife.BindView;
import butterknife.ButterKnife;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;




Thank you all in advance.
 
Saloon Keeper
Posts: 4560
115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That method call seems to be outside of any method, and thus not valid at that point. Did you mean to include it in the init method?
 
Thomas Lance
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean this method:



If so, I followed some example on StackOverwlof. I tryied to put that method in init(), but it says that non-static method cannot be referenced from a static context. Anyway, do you know how to solve my problem?
 
Thomas Lance
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My mistake. It's ok now. But my main problem is to set my lvTrack clickable in order to open a yt video of song that you clicked on.
Can you help me with that?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!