Skip to main content

Android app code for youtube channel

Click Hire Me For Making Android App to go to Create Android App
Youtube Channel App



MAINACTIVITY.XML

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:id ="@+id/play"
 tools:context="com.example.prosen.youtubeplayer.MainActivity">

<TextView
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="Hello World!"
 android:id="@+id/textView" />

<Button
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="Play"
 android:id="@+id/button1"
 android:layout_centerVertical="true"
 android:layout_centerHorizontal="true" />


<com.google.android.youtube.player.YouTubePlayerView
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:id="@+id/view1"
 android:layout_alignParentRight="true"
 android:layout_alignParentEnd="true"
 android:layout_above="@+id/button1"
 android:layout_alignParentLeft="true"
 android:layout_alignParentStart="true"
 android:layout_alignParentTop="true" />


</RelativeLayout> 

MAINACTIVITY.JAVA

 import android.support.v7.app.AppCompatActivity;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.Button;

 import com.google.android.youtube.player.YouTubeBaseActivity;
 import com.google.android.youtube.player.YouTubeInitializationResult;
 import com.google.android.youtube.player.YouTubePlayer;
 import com.google.android.youtube.player.YouTubePlayerView;

 public class MainActivity extends YouTubeBaseActivity{

 Button button;
 private YouTubePlayerView view;
 private YouTubePlayer.OnInitializedListener listener;

 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);

 view = (YouTubePlayerView)findViewById(R.id.view1)

 listener = new YouTubePlayer.OnInitializedListener() {
 @Override
 public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer  youTubePlayer, boolean b) {

 youTubePlayer.loadVideo("BvpqMiVNQ7s");

  }

 @Override
 public void onInitializationFailure(YouTubePlayer.Provider provider,  YouTubeInitializationResult youTubeInitializationResult) {
 button =(Button)findViewById(R.id.button1);
 button.setOnClickListener(new View.OnClickListener() {
 @Override
 public void onClick(View v) {
 view.initialize("AIzaSyAi_AF4xeTeo8Q_S0-3j0PFZWWLsycfzMs",listener);
 }
 });
 }
 };
 }

}





MANIFEST.XML

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

ONLY INPUT THE PERMISSION

Popular posts from this blog

Umbrella type Fish Trap

Jiophone Next Launched - Jio and Google lunch new Jio phone

  The world's cheapest Android smartphone is going to be the Jio Phone Next Lunch.It will be lunched before Diwali, but before that the company has shared its video. The video explains how to make the phone. This phone is being made in India only.Jio phone is being made in India is made for India. Made by India.Let me tell you what is special in this phone. This phone will get Pargati OS which will be Android powered.This is the best operating system, it has been specially made for India. Both Jio and Google have jointly prepared the phone. The phone's OS is named Pragati because the phone wants to bring progress in the country, the country will be the first Android phone to get it at a low price. Users will get a better experience even after the low price. The processor of Jio Phone Next has been prepared by qualmqoure. This smartphone will give a new opportunity to every citizen of the country to connect with digital.This phone is going to change the lives of lakhs of recrui

Vivo V23 5G and Vivo V23 Pro 5G with 50MP Dual Selfie Camera launched in India

Print  This phone is available for purchase on the company's official website, Flipkart and offline retailer stores. The pre-booking of Vivo V23 5G and Vivo V23 Pro 5G phones will start from January 5. While the base variant will be available for purchase from January 19 and the Pro variant.  Vivo V23 5G and Vivo V23 Pro 5G smartphones have been launched in India. Both these smartphones come with Fluorite AG glass bank panel, which has been claimed that this back panel changes color as soon as UV rays fall in the sunlight. The Vivo V23 55G and Vivo V23 Pro 55G smartphones are powered by MediaTek Dinance 920 and MediaTek 1200 processors, coupled with 12GB of RAM. These two Vivo phones come with 5G connectivity. In these, full-HD Plus AMOLED display and dual selfie camera have been given. The primary camera is of 50 megapixels. Vivo V23 5G, Vivo V23 Pro 5G price in India, availability The price of 8 GB RAM 128 GB storage variant of Vivo V23 5G phone is Rs 29,990 in India. Apart fro