Android programm the big n

Android Programming: The Big Nerd Ranch Guide, Second Edition

Android Programming: The Big Nerd Ranch Guide, Second Edition

It’s over! Brian, Kristin, Chris and I are finally done working on the second edition of Android Programming: The Big Nerd Ranch Guide, Second Edition.

Looking back on it, though, it’s all a blur. We spent months working on it! We must have been up to something.

A New IDE

Oh yeah—how could I have forgotten about the new IDE? Google released Android Studio last year. It was possible to work through the old book in Android Studio, but it was getting more and more frustrating with each passing month.

The new edition doesn’t have that problem. The entire thing is done using Android Studio: all the shortcuts and screenshots have been updated, making the reader’s experience much more pleasant.

Android Studio is a delightful development environment, and we’ve put some effort into showing off how it can make your life easier as a developer.

New Versions Of Android

Of course, that’s not all that’s changed. Android has seen a few new releases since we published the first edition of our guide. This might be the most important thing for some people who are thinking about reading our book. They want to see it on the cover: “This book covers the latest and greatest: Android 5.1!”

I remember writing a whole chapter on implementing material design, as well as sections describing how JobScheduler works. So I’m pretty sure readers will find a lot of Android 5.1 stuff in the book. (We’ve even managed to squeeze in a few bits about the upcoming M release.)

A Changing World Of Devices

For someone scanning books on Amazon, the number “5.1” is their best clue that a book is up-to-date. Android 5.1 is not yet installed on most devices, though. We’d be doing our readers a disservice if all we did was add a bunch of new content for a version of Android you can’t yet focus on.

In our first edition, many devices were still running Android 2.3 Gingerbread, so our code samples all ran on that version. Our new code listings are a lot cleaner now: they get rid of that ugly compatibility code, focusing on Android Jelly Bean and later releases. So we must have gone through and fixed all that stuff.

New Compatibility Tools

What about all the stuff in the support libraries that has changed? People don’t usually look for that on the cover, but that’s some of the coolest stuff in Android! If I were reading a book, I’d want to know about cool stuff like the RecyclerView and the new AppCompatActivity . And what about FloatingActionButton , or Snackbar ? Those things are so handy, I would feel really bad if we published a new version without talking about them somewhere.

Wait—hmm. I guess we put those in the new edition, too.

New and Updated Chapters

Jeez, that’s a lot of new stuff. We really put a lot of work into this thing.

But wait a second; there are some new chapters in this table of contents, too. There’s one here on property animators that I don’t think was in the first edition, plus a whole chapter on material design implementation tools. Who wrote a whole chapter on how theming works? That’s pretty awesome (I always hated having to deal with that stuff).

The older chapters look like they’ve been updated, too. SQLite is much earlier in the book than it was in the first edition—it looks like the big CriminalIntent example has a database back end now, which is pretty nifty. And the entire mapping and location exercise sequence has been completely rewritten, with a brand new sample app.

Go get it!

I’m playing it up a bit for this blog post, but I’m not kidding, either. I had really forgotten how much stuff we put into this edition. I didn’t even talk about all the work we put into refining and polishing, fixing continuity issues and bugs, either.

The whole point, of course, is to make your time getting up to speed on the latest and greatest in Android development easy and pleasant. So go pre-order a copy! We hope you find it useful. (We also hope that you remember the stuff we put in there better than I did.)

Источник

Android Programming: The Big Nerd Ranch Guide

Android Programming: The Big Nerd Ranch Guide

It’s been two years coming, but the first edition of Android Programming: The Big Nerd Ranch Guide is finally almost here. Brian and I got our hands on the first printed copies only a few days ago. We were indecently excited. Nobody wet themselves, but it was a near thing.

For those who don’t know, our guide to Android programming is the fruit of our Android bootcamp, a five-day intensive course that takes you from knowing Java to knowing Android. With our book, you can do the same thing at home. It’s like a Big Nerd Ranch home hair dye kit.

Читайте также:  Umineko no naku koro ni android

Two years is a long time! When we taught our first class with the materials that would eventually grow into this book, they were based on the latest and greatest phone OS, Android 2.3. Honeycomb had just been released, with a whole slew of new features and changes.

So what’s happened between then and now? Well, we taught a lot of classes, for one. When our students read through it, we found that many things we wrote in that first book just didn’t work, so we cut them down, threw them out or rewrote them. More than anything, though, we worked on one thing: fragments.

Fragments

When fragments first appeared in our book, they were second-class citizens. Fragments were for Honeycomb; Honeycomb was strictly a tablet release. Our students were much more interested in phones than tablets. That made fragments a low priority. Off to the back of the book they went!

However, a couple of things caused us to change our minds about their importance.

Hands-on Experience

The first was our consulting work. We had the opportunity to tackle a few tablet-only projects. The experience gave us a good excuse to jump head-first into using fragments in the real world.

In that work, we learned that fragments are actually pretty useful. Activities come with a lot of baggage. Once you switch over to a fragment instead, you find yourself free of those restrictions.

It also gave us questions that would nag at us: When should you use a fragment? When should you use an activity? The more we worked with the fragments, the more we wanted to pin down the answer to that question.

The Support Library

The second was the Android Support Library. This library was first introduced immediately after the release of Honeycomb, but it was fairly low-profile to start out with.

The importance of the Support Library is hard to overstate. The changes in Honeycomb were huge—almost all the fundamental APIs in Android were altered. Yet to this day, a majority of Android devices run pre-Honeycomb versions of Android. Without the Support Library to bridge the gap, it would be impossible to write real-world apps that use any of the new Honeycomb features at all.

As time passed, the Support Library became more and more fundamental to modern Android development. Luckily, it also became easier to use—nowadays, it is included in the default Android project template. All you have to do is remember to choose the right version of Fragment, and subclass FragmentActivity.

What We Teach

We decided on a fragment-first approach. Good Android apps should write most code in fragments, and only write code in activities to manage where those fragments live and how they talk to one another. Don’t need multiple fragments? Then your activity will have just one fragment.

This isn’t an earthshaking new perspective, of course; it’s best practice. We’re excited to show everyone how to do it, though, whether you’re brand new to Android or you’re looking to pick up the latest and greatest new tricks.

Источник

Android programm the big n

Learning the book «Android Programming: The Big Nerd Ranch Guide»

##Project 01 — GeoQuiz Screenshot:

###Chap 01 Your First Android Application

  • The layout name reverses the order of the activity name, is all lowercase, and has underscores between words. This naming style is recommended for layouts as well as other resources. Sch as QuizActivity—>activity_quiz .
  • Android application build process.

###Chap 02 Android and Model-View-Controller

  • A model object holds the application’s data and «business logic».
  • View objects know how to draw themselves on the screen and how to respond to user input, like touches.
  • Controller objects tie the view and model objects together.
  • MVC flow with user input

###Chap 03 The Activity Lifecycle

  • State: non-existent —> stopped (not visible) —> paused (visible) —> running (visible & foreground)
  • calls: onCreate() —> onStart() —> onResume() —> onPause() —> onStop() —> onDestroy()
  • Activity lifecycle.
  • Rotating the device changes the device configuration. The device configuration is a set of characteristics that describe the current state of an individual device. The characteristics that make up the configuration include screen orientation, screen density, screen size, keyboard type, dock mode, language, and more.
  • Note that Android destroys the current activity and creates a new one whenever any runtime configuration change occurs. You need a way to save this data across a runtime configuration change, like rotation. One way to do this is to override the Activity method. protected void onSaveInstanceState(Bundle outState) . This method is normally called by the system before onPause(), onStop(), and onDestroy().

###Chap 04 Debugging Android Apps

  • Android Lint is a static analyzer for Android code. A static analyzer is a program that examines your code to find defects without running it.

###Chap 05 Your Second Activity

  • Declaring activities in the manifest.
  • The simplest way one activity can start another is with the Activity method: public void startActivity(Intent intent) .
  • To add an extra to an intent, you use Intent.putExtra(…). In particular, you will be calling public Intent putExtra(String name, boolean value) .
  • When you want to hear back from the child activity, you call the following Activity method: public void startActivityForResult(Intent intent, int requestCode) .

###Chap 06 Android SDK Versions and Compatibility

Источник

Несколько книг для начинающего и продолжающего разработчика под Android

В прошлом году я входил в миры Android. Помимо изучения исходников, документации, статей, блогов, аудио- и видео-материалов по теме, читал книги. Спешу поделиться читательским опытом.

Под катом небольшой обзор восьми книг. Темы следующие:

  1. RxJava
  2. Потоки в Android
  3. Разработка под Android на Java
  4. Kotlin. Обзор языка
  5. Kotlin. Практика
  6. Kotlin. Обзор языка с уклоном на Android
  7. Разработка под Android на Kotlin
  8. Rx в Kotlin

Reactive Programming with RxJava: Creating Asynchronous, Event-Based Applications. By Tomasz Nurkiewicz,‎ Ben Christensen. O’Reilly Media; 1 edition October 27, 2016; 372 pages;
ISBN-13: 978-1491931653

Книга, которая на примере RxJava поможет понять вам, что такое реактивное программирование. Она требует от вас неплохое знание Java (по крайней мере, вы должны понимать, что такое обобщенные типы и лямбда-выражения) и предполагает последовательное чтение, т.к. материал подается шаг за шагом. Мне кажется, в этой связности и последовательности подачи материала — основная прелесть книги. Внимательный читатель получит полное представление о RxJava. В этом главный профит издания.

Но, даже если уверены в своих знаниях Rx, книга наверняка откроет вам что-то новое. Тем более, если вы только начинаете изучать тему. Если это так, то можно дать вам еще один совет: закрепляйте на практике пройденные темы и изучайте open-source проекты. Так вы быстрее освоите Rx.

Недостатком книги можно считать тот факт, что она имеет в виду версию RxJava 1.1.6. Во второй версии RxJava претерпела некоторые существенные изменения (см. статьи на Хабре Исследуем RxJava 2 для Android и ReactiveX 2.0 с примерами, а также полный список изменений на wiki проекта What’s different in 2.0), и поэтому некоторые места в книге устарели. Однако эти изменения вытекали из общей логики развития RxJava и в книге о них идет речь. Думаю, второе издание должно поставить все на свои места, хотя к этому моменту, возможно, появиться RxJava 3.

Еще один небольшой недостаток, на мой взгляд: книга недостаточно развернуто объясняет теорию реактивного программирования и начинающему разработчику может быть нелегко войти в тему. Хорошее место для этой цели первая глава, но она (с учетом отличий от RxJava 2) выглядит запутанной.

Непосредственно работе RxJava в Android посвящена восьмая глава. Много прекрасно разобранных практических примеров. Но опять же, на сегодня охват возможностей Rx в Android неполон.

В целом, ни один из недостатков не перечеркивает достоинств книги. Она может быть рекомендована к чтению как начинающими разработчиками, так и опытными девелоперами.

Кроме прочего, всегда интересно посмотреть, каких на этот раз животных поместило на обложку издательство O’Reilly.

Есть перевод на русский:

Нуркевич Т., Кристенсен Б. Реактивное программирование с применением RxJava. Разработка асинхронных событийно-ориентированных приложений. ДМК Пресс, 2017 год, 358 стр.
ISBN: 978-5-97060-496-0

Efficient Android Threading: Asynchronous Processing Techniques for Android Applications. By Anders Goransson. O’Reilly Media; 1 edition June 13, 2014; 280 pages;
ISBN-13: 978-1449364137
Книга делится на две части. В первой вы узнаете, что находится под капотом операционной системы (ОС) Android: из каких компонентов состоит ОС, как организовано взаимодействие между потоками и между процессами, и как Android организует управление памятью. Во второй части вы научитесь управлять потоками и процессами, узнаете различные механизмы для этого, познакомитесь подробней Service и фреймворком Loader .

Из минусов, на мой взгляд, можно назвать то, что в книге не слишком подробно объясняется взаимодействие между процессами (фрейворк Binder, AIDL), как с теоретической, так и с практической стороны. И, поскольку, книга написана до второй половины 2014 года, мы не найдем в ней то, что появилось с момента выхода Android Lollipop 5.0. Например, можно вспомнить планирование задач с использованием JobScheduler, Doze Mode, ограничения на запуск Service , которые мы получили в Android Oreo 8.0… etc.

То, что есть недостатки, можно отнести скорее к лаконичному стилю изложения (книга обложка перевода

Android Programming: The Big Nerd Ranch Guide. By Bill Phillips, Chris Stewart & Kristin Marsicano. Big Nerd Ranch Guides; 3 edition February 9, 2017; 624 pages;
ISBN-13: 978-0134706054
Действительно неплохая книга, которую можно смело рекомендовать начинающим разработчикам или преподавателям, для составления программы обучения Android-разработке. Если вы начинающий разработчик, то в книге вы найдете множество приемов и примеров для программирования Android-приложений, к которым вы бы могли идти самостоятельно довольно долго. Книга начинает с «Hello world» и через теорию, упражнения и написание небольших приложений, обучает основному стеку технологий для создания Android-приложения. Требует среднего знания Java.

Из минусов я бы назвал неравномерную сложность, довольно большой объем. Думаю, если вы начнете проходить книгу от корки до корки, то для этого вам понадобится много терпения. Не факт, что такой способ не замедлит ваше развитие, как разработчика. Я бы рекомендовал использовать этот фолиант скорее как справочник по интересующей вас теме (теорию быстрее узнать, например, на каком-либо онлайн-курсе), а для скорейшего вхождения в тему Android-разработки — писать свои проекты и изучать, как пишут код другие разработчики.

Есть перевод на русский:

Филлипс Б., Стюарт К., Марсикано К.Android. Программирование для профессионалов. 3-е издание / пер. с англ. — СПб.: Издательский дом «Питер», 2017 год, 688 стр.
ISBN: 978-5-4461-0413-0

Kotlin in Action. By Dmitry Jemerov & Svetlana Isakova. Manning Publications; 1 edition February 19, 2017; 360 pages;
ISBN-13: 978-1617293290
«Kotlin в действии» — книга от создателей языка. Книга очень хорошо написана. Я имею в виду структуру материала, стиль повествования и оформление текста. Сложилось впечатление, что авторы взяли все лучшее из книг о языках программирования и воплотили это в своей работе. Главная их заслуга в том, что они сумели отойти от формализма документации и смогли показать особенности языка и историю его развития так, что мы получили своего рода «рассказ», связанное повествование, за развитием «сюжета» которого следишь с интересом.

Книга удачно разделена на главы, параграфы и разделы. Материал организован от простого к сложному. Книга предполагает, что читатель знает Java на достаточном уровне, поскольку язык Kotlin во многом опирается на Java. Если вы Android-разработчик, который пишет, или которому предстоит писать на Kotlin, тогда эта книга для вас. Но если вы начинающий девелопер и недостаточно сильны в Java, вы также можете читать эту книгу. Вам просто придется чуть больше поработать над ней. Даже теория (например, теория лямбда-выражений или обобщенных типов) объяснена в книге очень хорошо. И это здорово поможет войти в тему, если вы делаете первые шаги в программировании.

Книга имеет в виду Kotlin 1.0, поэтому, например, в ней отсутствует описание корутин (coroutine).

Книга не привязана к конкретной предметной области (например, Kotlin в Android), и может использоваться как отличное введение для всех, кто изучает Kotlin.

Есть перевод на русский:

Исакова С., Жемеров Д. Kotlin в действии / пер. с англ. Киселев А.Н. — М.: ДМК-Пресс, октябрь 2017 г., 402 стр.
ISBN: 978-5-97060-497-7

Kotlin for Android Developers: Learn Kotlin the easy way while developing an Android App By Antonio Leiva. CreateSpace Independent Publishing Platform; 1 edition March 21, 2016; 212 pages;
ISBN-13: 978-1530075614
Это была первая книга, которая вышла о языке Kotlin. По сравнению с книгой «Kotlin in action» она проигрывает как введение в язык, но вместе с тем может служить примером использования языка в Android. В книге разрабатываются приложения, исходники которых лежат на GitHub.

Минусы: материал в книге довольно запутан, автор часто ссылается на репозиторий в GitHub, но при этом не всегда можно понять какую ветку он имеет в виду. Впечатление, что написанное в книге, лучше подходит для формата блога или серии статей о разработке приложения на Kotlin.

В книге можно найти пару-тройку интересных приемов программирования на Kotlin под Android.

Android Development with Kotlin By Marcin Moskala & Igor Wojda. Packt Publishing — ebooks Account, September 6, 2017; 440 pages;
ISBN-13: 978-1787123687
Книга по-сути является рассказом о языке Kotlin. Хотя и всегда имеет в виду разработку под Android. Но непосредственно создание небольшого приложения, происходит только в последней главе. Мне представляется, что в плане введения в язык эта книга проигрывает книге «Kotlin in action».

Главный минус, что эта книга никак не является введением в Android-разработку на Kotlin, так что название может путать читателя. Англоязычные читатели жалуются на плохой английский, но я не заметил, конечно.

Саму книгу не дочитал (книги «Kotlin in action» вполне хватает для введения в язык), поэтому не могу судить о ней с полной уверенностью.

В электронной версии книгу очень удобно читать на сайте издательства с помощью специальной читалки Mapt.

У одного из авторов есть занятные статьи: например, о кроссплатформенности на Kotlin.

Mastering Android Development with Kotlin: Deep dive into the world of Android to create robust applications with Kotlin By Milos Vasic. Packt Publishing — ebooks Account, November 8, 2017; 378 pages;
ISBN-13: 978-1788473699
Эту книгу можно считать полноценным введением в разработку под Android. Она начинает с установки Android Studio, проходит по многим аспектам Android, и заканчивает объяснением публикации приложения на Google Play. В этом смысле книга — некий аналог книге «Android Programming: The Big Nerd Ranch Guide», только на Kotlin. Поэтому книга может быть рекомендована начинающим разработчикам, которые решили освоить разработку под Android через Kotlin. Книга предполагает базовое знакомство с Kotlin.

Мне кажется, что книга не слишком глубоко говорит о разработке на Android, но объясняет нужные вещи. Например, работу с Git или использование библиотеки Retrofit. Что касается использования языка Kotlin для обучения разработке под Android, то сам автор предупреждает, что Kotlin лишь дополнительный инструмент для Android, и Java, как и С++ (для Native), еще никто не отменял.

Как я уже говорил, электронные книги данного издательства удобно читать, благодаря встроенной читалке Mapt.

Reactive Programming in Kotlin: Design and build non-blocking, asynchronous Kotlin applications with RXKotlin, Reactor-Kotlin, Android, and Spring By Rivu Chakraborty. Packt Publishing — ebooks Account, December 5, 2017; 322 pages;
ISBN-13: 978-1788473026
Эта книга появилась недавно, так что я не успел достаточно хорошо с ней познакомиться. Но, что сразу бросается в глаза — она начинается с пространного введения, объясняющего концепцию реактивного программирования, и, затем, плавно переходит на Rx (в данном случае, RxKotlin). Книга имеет в виду вторую версию Rx, что выгодно отличает ее (как и более полное введение) от первой книги («Reactive Programming with RxJava») в этом обзоре. Хотя само объяснение сущностей Rx, операторов, концепции backpressure и т.д. дается в гораздо более лаконичной форме. Этот факт, не позволяет считать данную книгу полноценной заменой первой.

Об RxKotlin в Android идет речь в последней главе. Читатель знакомится с возможностями RxKotlin в Android на примере небольшого приложения, в котором, кроме прочего, используется Retrofit вместе с адаптером от Джейка Вортона.

Книга хорошо оформлена и разбита на главы и разделы, читается быстро. Может быть рекомендована, в дополнение к первой книге об Rx в этом обзоре, особенно для девелоперов изучающих Kotlin. Предполагает знакомство с Kotlin на базовом уровне.

Остальные книги о Kotlin см. на этой странице оф. сайта языка и на сайте издательства Packt Publishing.

Источник

Оцените статью