Testing YouTube Android Player API on Android phone & Android TV


  I tested YouTube Android Player API on Android TV devices. Sadly it is not working well with Android TV’s YouTube app (“YouTube for Android TV”). Only YouTube App Launcher Intents works well for now (2016.1.14). YouTube Android Player API YouTube Android Player API is an official library on Google Developers web site, which enables us to integrate YouTube functionality into our (third party’s) Android apps. We can control YouTube video/playlist playback from our app, and customize playback view using YouTube Android Player API. YouTube app must be installed on user’s device As written in the official page, How it works The API client library interacts with a service that is distributed […]

Continue reading →

– Android TV application hands on tutorial 19


Showing icons on vertical alignment We learned BrowseFragment to show icons, where icons are aligned horizontally when the size increases. VerticalGridFragment is another Fragment provided by leanback support library, where it shows the icons with vertical alignment.   For example, I guess Sideload Launcher – Android TV is using this VerticalGridFragment to show installed app icons.  This post explains how to implement VerticalGridFragment. The implementation is referenced from Google’s sample implementation in the same way as before. Create parent Activity – VerticalGridActivity Starting by creating Activity. right click on “ui” package, [New] → [Activity] → [Blank Activity], type Activity Name as “VerticalGridActivity” and click [Finish]. It will automatically create VerticalGridActivity class, activity_vertical_grid.xml layout resource and add this […]

Continue reading →

BrowseFragment ListRow customization
– Android TV application hands on tutorial 18


More customization of BrowseFragment – Multiple rows icon alignment on ListRow Continuing from the previous chapter, BrowseFragment Header customization, I proceed to customizing ListRow. Chapter 17: Customizing Header Chapter 18: Customizing ListRow (we are here!) Leanback Launcher app shows multiple rows in Apps, Games bar if the number of icon is many (2 rows are used for “Apps” category in above picture). But original ListRow provided by Leanback support library only allows to show contents in one line. In this chapter, goal is to allow ListRow to show multiple rows in each header, by making customized class of ListRow (Model) and ListRowPresenter (Presenter). Explanation: Dig in source code  ListRow (Model), ListRowView (View), ListRowPresenter (Presenter) is used for […]

Continue reading →

BrowseFragment Header customization
– Android TV application hands on tutorial 17


More customization of BrowseFragment – Showing icon beside the Header title The basic implementation of BrowseFragment is already explained in this tutorial. I’m going to proceed some advanced customization in following chapters. Chapter 17: Customizing Header (we are here!) Chapter 18: Customizing ListRow Aim is to change the design of header, to show icons on the left of header title text, as shown in the above image. How to customize header design Leanback support library adopts MVP (Model-View-Presenter) architecture*, and HeaderItem (Model) is not an exception. We can prepare our own View and Presenter to customize the design of header. * MVP is explained in Chapter 14.  Step is as follows, Make own Model (If necessary): Java class which […]

Continue reading →

Background data loading
– Android TV application hands on tutorial 15


Background data loading using Loader class This Tutorial was explaining about Leanback support library, which is usually used to show list of contents information. So developers may want to load a many meta data to show contents. When Activity or Fragment need to prepare big size of data, it is better to load the data in background. For this purpose, we can use Loader and LoaderManager. They are useful to implement background data loading followed by updating UI based on these loaded data. I’m going to implement this Loader in this chapter. To study about Loader, I found a very nice article to understand Loader and the LoaderManager in detail (from part 1 to part 4). This post is […]

Continue reading →

Data loading from web
– Android TV application hands on tutorial 16


  * You can see the JSON video data used in this post at here: https://raw.githubusercontent.com/corochann/AndroidTVappTutorial/master/app/src/main/assets/video_lists.json  Manage data online, keep updated. In the previous chapter, Background data loading – Android TV application hands on tutorial 15, I introduced LoaderManager and Loader class which helps to load/prepare (maybe time consuming) data in background. One of the example of “time consuming” data preparation is loading data from network. If you can provide the data from the web, app can always show updated, latest information. In this chapter I will implement web data loading, to show our video contents information. We will prepare data in json format, and upload it to the web (https://raw.githubusercontent.com/corochann/AndroidTVappTutorial/master/app/src/main/assets/video_lists.json for now). It […]

Continue reading →

Finding videos, photos, musics which you can use freely


When I’m doing personal project, or making some documents, it always bother me how to find out contents (icons, videos, photos/pictures, musics) in accordance with copy right issues.  However, you don’t need to worry about copy right issues with contents under CC0 (public domain) license. Here, I will list up some links which is under Creative Commons license. Videos/Photos When I Google with “cc0 video”, it shows several web services which is providing CC0 lisenced videos.  PEXELS VIDEOS, PEXELSShort scenery videos are provided in this site, the video is categorized so that you can look through the web site easily.The videos in this site is all CC0 license. PLiXSSimilar to PEXELS, you can find only […]

Continue reading →

Fast, easy Parcelable implementation with Android studio Parcelable plugin


Starting from conclusion Use Parcelable class is always encouraged for better performance, while it is much easier to use Serializable class for fast checking/implementation. Easy & fast implementation of Parcelable? → Use Android studio plug-in! Serializable and Parcelable difference Serializable & Parcelable class can be used to pass object references from one Activity to the other Activity via Intent/Bundle. Your object must implement either  Serializable or Parcelable in order to pass it via Intent. Serializable, the Master of Simplicity Parcelable, the Speed King by Parcelable vs Serializable Serializable is defined in JAVA language as  a marker interface, so after implementing Serializable no extra method implementation is needed. It is very easy to use, but the performance is not good since serializing […]

Continue reading →

Importing Android SDK with hidden APIs

How to import ActivityManagerNative? My first motivation was to use AndroidManagerNative class, even you can find this class in Android open source project, you can’t use it in our app when you build with usual Android SDK. Yes, some of the classes are hidden in SDK. More specifically, $SDK_PATH/platforms/android-xx/android.jar contains limited APIs for Android app developers. I put memo how to use these hidden classes/methods in your Android app development from Android studio (which works with build.gradle). Building Android SDK including all APIs First step is to prepare library which includes hidden Android APIs. Below link answers how to do this. How do I build the Android SDK with hidden and […]

Continue reading →

Noticeable changes for Android Marshmallow 6.0


What has changed from Android Lollipop to Marshmallow from user point of view on Android TV? Below is the noticeable changes when I use Nexus Player with Android Marshmallow (see how to update). Precise permission control for each App When we go to [Settings] → [Apps] → Select specific app  → [Permissions], we can set to allow/disallow apps to use permissions one by one. It becomes more customizable, (I fell it too complicated though). Security patch Other than the Android software version update, it seems there’s a Android security patch update frequently. So far, the big change I can find from user point of view is only these stuffs. Followings are the […]

Continue reading →