Android development tutorial



tim kilbourn: hi,i'm tim kilbourn, from the android framework team. and i want to talk aboutbuilding great apps for android tv. android tv appsare developed using


Android development tutorial, all the familiarcomponents and tools from the android framework. so if you already have agreat phone or tablet app, you're on your way tobringing that experience


to the big screen. however, there aresome key differences between developing for aphone or a tablet, and a tv. in particular, theinformation density on a tv should be much lower thanon a phone or a tablet. no one wants to read awall of text on a tv. also, the way we interact withthe tv is through a d-pad, like a remote control or gamecontroller, rather than touch. so make sure all of theimportant elements of your app


are focus-able. let's look at an example ofan app written for android tv. this app uses minimalamounts of text, and everything isreachable with the d-pad. navigating to findsomething to watch is easy with these layouts. in fact, becausethis browsing concept is so common for a tv app, we'vebuilt a new support library to help you createbeautiful, easy


to use apps for the big screen. by using the widgets andfragments from this leanback support library, you willbe able to quickly create apps that work well on tvs. the leanback support libraryis based on the model, view, presenter pattern. we've made itstraightforward to separate the way you display yourcontent from the model objects you usedto store the data.


the model objectscome from your app. we don't put anyrequirements on them, so it should be possibleto update an existing app to run on a tv withoutchanging your model. the views are thestandard android views that you know and love, liketext views and image views and so on. what is new for android inthis library is the presenter. given a modelobject, the presenter


binds the data fromthat object to a view that the library codecan use to display your items in all thescreens of your app. in particular,this same item can be rendered in different ways,in different parts of your app, simply by replacingthe presenter. let's look at some examples. here we have a screenthat lets the user browse through the content catalog.


this is implementedusing a browse fragment from the leanbacksupport library. the fragment is instantiatedand given an object adapter that contains the modelobjects and the presenters used to render them. the library code in thefragment takes care of the rest, calling the methodsand the presenters for each item to showthe views in the rows. next, we have a detail screen.


the same model objectthat was previously rendered using a smallcard view can now be rendered to showmore details simply by using a different presenter. we also see rowsof related content below the detailsoverview, with presenters creating each ofthose views as well. in-apps search worksin the same way. your app will receivethe text of the query


as the user enters it,and the search fragment uses the objectadapter and presenters that you provide toshow the results. there are a fewother things you'll want to do to make yourapp look great on a tv. we've designed anew launcher that's optimized for gettingyou into the content you want to see asquickly as possible, and that starts withcontent recommendations.


using the existingandroid notifications api, your app can publishrecommendations for videos or other content theviewers will want to see next. you specify the data, includingthe card image in the text. and the launcher will show therecommendations prominently on the home screen. the order of allthese recommendations is determined by how theuser interacts with them. so make sure you're creatinghigh-quality recommendations


that will make people wantto return to your app. you can find moredetails and sample code


Android development tutorial

for presenters, fragments,and content recommendations, on the new developersite for android tv. thanks for watching. now go make some great tv apps.


Android development tutorial Rating: 4.5 Diposkan Oleh: PaduWaras