install android studio

How to embed/integrate Youtube in Android App

Embed Youtube :

In Today’s world, all products who wish to enter the market need a strong presentation to the people who are interested in that product. And today’s best way to present anything behind the world is to make an effective video in which the product is fully described with entertainment. The biggest platform in today’s world to show and spread the product, message, education, etc with a video is YOUTUBE which has billions of users for surfing to see the videos.

In many android apps, many times there is a requirement of the users to show the video presentation which can be related to any of topics like education, technical, products etc. For this, we can embed or integrate youtube in our android app to show the videos within the app.


For implementing the integration of youtube in android apps, follow the steps below carefully :


<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name=""/>

2. activity_youtube.xml :

< view
class="" />

3. :

public class MainActivity extends YouTubeBaseActivity {
    Button button;
    OnInitializedListener onInitializedListener;
    TextView textView;
    YouTubePlayerView youTubePlayerView;

   public class youtube implements OnClickListener {
        youtube() {

        public void onClick(View v) {
            MainActivity.this.youTubePlayerView.initialize(projectConfig.API_KEY, MainActivity.this.onInitializedListener);

    public class static implements OnInitializedListener {
        youtube() {

        public void onInitializationSuccess(Provider provider, YouTubePlayer youTubePlayer, boolean b) {

        public void onInitializationFailure(Provider provider, YouTubeInitializationResult youTubeInitializationResult) {

    protected void onCreate(Bundle savedInstanceState) {
        this.button = (Button) findViewById(;
        this.youTubePlayerView = (YouTubePlayerView) findViewById(;
        this.onInitializedListener = new Listener();
        this.button.setOnClickListener(new View());



About the author

Generic Bytes

Hi! we are from Generic Bytes an aspiring bloggers with an obsession of things tech.This blog is dedicated to people who want to learn the technology.

View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *