Download and import YouTube Android Player API

YouTube Android Player API enables you to incorporate video playback functionality into your Android applications. The API defines methods for loading and playing YouTube videos (and playlists) and for customizing and controlling the video playback experience.

I will show the steps to develop Android App with YouTube Android Player API step-by-step, please refer the post YouTube Android Player API step-by-step.

To develop Android apps with YouTube Android Player API, you have to download and import the YouTube Android Player API jar to your project.

- New a Android Application Project.

- Download and unzip YouTube Android Player API here.

- Copy the unzipped YouTubeAndroidPlayerApi.jar file to /libs folder in your project. The YouTubeAndroidPlayerApi.jar file should be in /libs sub-folder of your unzipped files.

import YouTubeAndroidPlayerApi.jar

- Right click your project, select , then select Java Build Path and click Add JARs... button.


- Select YouTubeAndroidPlayerApi.jar, and click OK.


Android Studio 0.1.5 Released

Android Studio 0.1.5 just Released. This release contains only bug fixes and infrastructure work, as well as a merge with the latest IntelliJ 13 development branch.

~ source: https://sites.google.com/a/android.com/tools/recent/studio015released

Install/Update Android Studio:

If you are already running Android Studio, just restart it, or manually check for updates via Help > Check for Update... (on OSX, look in the Android Studio menu).

If you do not already have Android Studio, install the latest full install from
http://developer.android.com/sdk/installing/studio.html#download

Options for DatePicker to display or hide calendar view and spinners

The former exercise show a "Simple example of using DatePicker with both calendar view and spinners". We can show/hide calendar view and spinners individually in XML with android:calendarViewShown and android:spinnersShown attributes. Introduced in API level 11, we can also program it using Java code with setCalendarViewShown() and setSpinnersShown() methods.

Options for DatePicker to display or hide calendar view and spinners


<LinearLayout 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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context=".MainActivity" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<RadioGroup
android:id="@+id/optGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<RadioButton
android:id="@+id/optCalendar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CalendarView"
android:checked="true" />
<RadioButton
android:id="@+id/optSpinners"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Spinners" />
<RadioButton
android:id="@+id/optBoth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Both" />
</RadioGroup>
<DatePicker
android:id="@+id/pickerdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:calendarViewShown="true"
android:spinnersShown="false" />

</LinearLayout>


package com.example.androiddatepickershown;

import android.os.Bundle;
import android.widget.DatePicker;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.app.Activity;

public class MainActivity extends Activity {

RadioGroup groupBtn;
RadioButton btnCalendar, btnSpinners, btnBoth;
DatePicker pickerDate;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
groupBtn = (RadioGroup)findViewById(R.id.optGroup);
btnCalendar = (RadioButton)findViewById(R.id.optCalendar);
btnSpinners = (RadioButton)findViewById(R.id.optSpinners);
btnBoth = (RadioButton)findViewById(R.id.optBoth);
pickerDate = (DatePicker)findViewById(R.id.pickerdate);

groupBtn.setOnCheckedChangeListener(new OnCheckedChangeListener(){

@Override
public void onCheckedChanged(RadioGroup arg0, int arg1) {
if(btnCalendar.isChecked()){
pickerDate.setCalendarViewShown(true);
pickerDate.setSpinnersShown(false);
}else if(btnSpinners.isChecked()){
pickerDate.setCalendarViewShown(false);
pickerDate.setSpinnersShown(true);
}else{
pickerDate.setCalendarViewShown(true);
pickerDate.setSpinnersShown(true);
}
}});
}

}


YouTube Android Player API step-by-step

The YouTube Android Player API enables you to incorporate video playback functionality into your Android applications. The API defines methods for loading and playing YouTube videos (and playlists) and for customizing and controlling the video playback experience.

Using the API, you can load or cue videos into a player view embedded in your application's UI. You can then control playback programmatically. For example, you can play, pause, or seek to a specific point in the currently loaded video.

You can also register event listeners to get callbacks for certain events, such as the player loading a video or the player state changing. Finally, the API has helper functionality to support orientation changes as well as transitions to fullscreen playback.






Develop Android App with YouTube Android Player API step-by-step:

Related:

How to use the new Google Maps: A map built for you



Get smarter recommendations with the new Google Maps.
http://maps.google.com/preview

Motion Design Presentation for Ubuntu Mobile

This is a presentation of 'Paper' Motion theme which has been applied to some of the core movements on Ubuntu Mobile.



Know more: OMG! Ubuntu! New Interface Animations Demoed for Ubuntu Touch