Facebook Twitter Instagram
    DeepCrazyWorld
    Facebook Twitter Instagram Pinterest YouTube
    • FLUTTER
      • FLUTTER APP
        • QRCode
        • Quiz App
        • Chat GPT
        • PDF App
        • News App
        • Fitness App
        • Weather App
        • BMI Calculator
        • GAME APP
        • Ecommerce App
        • wallpaper App
        • Finance app
        • Chat App
        • Wallet App
        • Taxi App
        • Quran app
        • Music player app
      • FLUTTER UI
        • Splash Screen
        • Onboarding Screen
        • Login Screen
        • Card Design
        • Drawer
    • PROJECT
      • Android Projects
      • College Projects
      • FLUTTER APP
      • Project Ideas
      • PHP Projects
      • Python Projects
    • SOURCE CODE
    • ANDROID
      • ANDROID APP
      • GAME APP
      • ANDROID STUDIO
    • MCQ
      • AKTU MCQ
        • RPA MCQ
        • COA MCQ
        • HPC MCQ
        • SPM MCQ
        • Renewable Energy All MCQ
        • Data Compression MCQ
        • Data Structure MCQ
        • Digital Image Processing MCQ
        • Software Engineering MCQ
        • Machine Learning MCQ
        • Artificial Intelligence MCQ
      • D PHARMA MCQ
        • Pharmaceutics – I MCQ
        • Pharmacognosy MCQ
        • Pharmaceutical Chemistry MCQ
        • Biochemistry and Clinical Pathology MCQ
        • Human Anatomy and Physiology MCQ
        • Heath Education and Community Pharmacy MCQ
    • INTERVIEW QUESTIONS
      • Flutter Interview Questions
      • INTERVIEW QUESTIONS
      • Python Interview Questions
      • Coding ninjas solution
    • MORE
      • WORDPRESS
        • SEO
        • TOP 10 WORDPRESS THEME
      • PRODUCTIVITY
      • Program
      • QUOTES
    DeepCrazyWorld
    Home»ANDROID APP»How To Create YouTube Android App In Android Studio (Step By Step)
    ANDROID APP

    How To Create YouTube Android App In Android Studio (Step By Step)

    DeepikaBy DeepikaAugust 5, 2020Updated:January 19, 2022No Comments3 Mins Read

    How To make YouTube Android App In Android Studio [Step By Step]
    Do you know creating YouTube Android App is so easy as you just need to understand how to use YouTube API for that.How to Convert your YouTube Channel into an App for Free

    In this application we will share about adding YouTube functionality to your Android application. Further we will also create playlist and run on real device. Will make use of multiple Android UI components to design and step by step developing a YouTube App in Android Studio.

    <img decoding=

    Topics Used For Creating YouTube App – Before following the below steps it is recommended you check out Image View, Button, Linear Layout & Relative Layout topics. Also go through JAVA OOPS concept once.

    Table of Contents

    Toggle
    • Steps To Create a YouTube Application In Android Studio:
      • Add in Gradle Scripts >> build.gradle (Module: app)
        • iii of Step 8) Nextly we gonna add listeners in the code as:
    • ativity_main.xml
    • AndroidManifest.xml.
      • Adding Internet Permission In Android Studio
    • MainActivity.java
      • OUTPUT:
    • YouTube Video
    • Conclusion
      • Cheers!
    • READ MORE

    Steps To Create a YouTube Application In Android Studio:


    Below you can download code, see final output and step by step explanation of YouTube App in Android Studio

    Step 1: Firstly get the Android Studio downloaded in your system, then open it.

    Step 2: Create a new project choose basic activity and name it YoutubePlayer.

    Now please read this tutorial How To choose basic activity.

    Step 3: Now click here to download the YouTube Android Player API.

    Step 4: After downloading extract the downloaded compressed folder, open it and find a executable jar file in libs folder.

    Now please read this tutorial How To Add External JAR Files In Android Studio

    Step 5: Copy this library and paste in your YoutubePlayer application app -> libs

    Step 6: Add dependencies to build.gradle file and sync. Adding this will make our application compatible to add youtube functionality.

    Add in Gradle Scripts >> build.gradle (Module: app)

    Now please read this tutorial for Implementing abstract method.

    iii of Step 8) Nextly we gonna add listeners in the code as:

    youTubePlayer.setPlayerStateChangeListener(playerStateChangeListener);
    youTubePlayer.setPlaybackEventListener(playbackEventListener);
    iv of Step 8) You need to add Google API Key (it’s a unique key uses to take advantage of youtube functionality) and Youtube Video ID(it’s the id of video we want to play) for that follow following steps:

    Open this link first.
    You need to login first to get into this link thought your google ID.
    Now you need to create a project then name that project.

    Firstly change the relative layout to linear layout and add its orientation to vertical also remove the padding in the layout. See the code to be added.

    Complete code of activity main file

    ativity_main.xml

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">
    
        <WebView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:id="@+id/webView"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true" />
    </RelativeLayout>

    Step 11: Add users permission for internet in

    AndroidManifest.xml.


    Adding Internet Permission In Android Studio

       <uses-permission android:name="android.permission.INTERNET"/>
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.dude.technicdude">
    
        <uses-permission android:name="android.permission.INTERNET"/>
    
        <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">
            <activity android:name="com.dude.technicdude.MainActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    
    </manifest>


    Step 12: Open file color.xml, add button in it which will redirect user to youtube player colors.

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
    <color name="colorPrimary">#FF0000</color>
    <color name="colorPrimaryDark">#580606</color>
    <color name="colorAccent">#D81B60</color>
    </resources>

    Step 13: Now open MainActivity.java class and paste the following code.

    MainActivity.java

    package com.dude.technicdude;
    
    import androidx.appcompat.app.AppCompatActivity;
    
    import android.os.Bundle;
    import android.webkit.WebSettings;
    import android.webkit.WebView;
    import android.webkit.WebViewClient;
    
    public class MainActivity extends AppCompatActivity {
        private WebView myWebView;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
            myWebView = (WebView) findViewById(R.id.webView);
            myWebView = (WebView) findViewById(R.id.webView);
            WebSettings webSettings = myWebView.getSettings();
            webSettings.setJavaScriptEnabled(true);
            myWebView.loadUrl("https://www.youtube.com/channel/UC4M4mrKDDJoK5gocuCwet8w");
            myWebView.setWebViewClient(new WebViewClient());
    
        }
    
        @Override
        public void onBackPressed() {
            if (myWebView.canGoBack()) {
                myWebView.goBack();
            } else {
    
                super.onBackPressed();
            }
        }
    }

    OUTPUT:

    Now run this App and use the play the YouTube video you added.

    YouTube Video

    Conclusion

    We have successfully created a YouTube app in android studio


    Cheers!

    Don’t forget to share this post!

    READ MORE

    Share. Facebook Twitter LinkedIn WhatsApp Telegram Pinterest Reddit Email
    Previous ArticleSudoku : How to Make a Sudoku puzzle Game in html
    Next Article Quiz App in Android studio source code free – Android Studio Tutorial

    Related Posts

    Music player app in flutter and dart using node.js music API

    ANDROID APP 2 Mins Read

    How to create Simple movie app with Source code 2023

    ANDROID APP 4 Mins Read

    Scratch to Win Android Earning App (Admob, FB Ads, StartApp, Unity Ads)

    ANDROID APP 2 Mins Read

    Covid-19 Tracker App(Coronavirus Tracker) source code 2023

    ANDROID APP 3 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • Implementing a Dynamic FAQ Screen UI in Flutter Using ExpansionTile March 29, 2025
    • Creating an Instruction UI Screen in Flutter Application March 29, 2025
    • Animated Backgrounds in Flutter: A Complete Guide March 15, 2025
    • How to make Diary App using flutter stepwise using getx August 31, 2024
    • How to Create Music Player UI screen with fully functional in flutter August 30, 2024
    • How to make ListView Builder Ui in flutter with Source Code August 29, 2024
    • Create a TabBar View in flutter with fully functional stepwise August 28, 2024
    • How to create TabBar view in flutter with source code step wise August 27, 2024
    • How to make Heart rate measure app with Flutter stepwise August 26, 2024
    • How to make ChatGpt App in flutter with source code Stepwise August 25, 2024
    Facebook Twitter Instagram Pinterest YouTube
    • About
    • Contact
    • Disclaimer
    • Privacy Policy
    Copyright by DeepCrazyWorld © 2025

    Type above and press Enter to search. Press Esc to cancel.