SlideShare une entreprise Scribd logo
1  sur  14
Android Getting Started
The UPTech way
What’s on the list?
Basic Libraries
Dependency Injection with Dagger 2
RxAndroid
Custom Views FTW
The Future: Kotlin
Basic Libraries
Butterknife
Retrolambda
REST Trio: Retrofit, OkHttp, Gson
Image Loading: Glide, Fresco
Realm
Dependency Injection with Dagger 2
class ApiService {
public void uploadPhoto(String user, File file) {
OkHttpClient client = new OkHttpClient();
Gson gson = new Gson();
Request request = // TODO build a post request
client.newCall(request).execute();
}
}
Dependency Injection with Dagger 2
class ApiService {
Gson gson = new Gson();
OkHttpClient client = new OkHttpClient()
public void uploadPhoto(String user, File file) {
Request request = // TODO build a post request
client.newCall(request).execute();
}
}
Dependency Injection with Dagger 2
class ApiService {
Gson gson;
OkHttpClient client;
public ApiService(OkHttpClient client, Gson gson) {
this.client = client;
this.gson = gson;
}
public void uploadPhoto(String user, File file) {
Request request = // TODO build a post request
client.newCall(request).execute();
}
}
Dependency Injection with Dagger 2
OkHttpClient client = new OkHttpClient();
Gson gson = new Gson();
ApiService apiService = new ApiService(client, gson);
apiService.uploadPhoto("UPTechTeam", file);
Dependency Injection
OkHttpClient client = new OkHttpClient();
Gson gson = new Gson();
ApiService apiService = new ApiService(client, gson);
RealmConfiguration config = new RealmConfiguration.Builder(context)
.deleteRealmIfMigrationNeeded()
.build();
Realm.setDefaultConfiguration(config);
Realm realm = Realm.getDefaultInstance();
Preferences preferences = new Preferences(context);
AccountManager accountManager = new AccountManager(apiService, database, preferences);
accountManager.getUser();
Dependency Injection
@Inject
AccountManager accountManager;
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Application.appComponent().inject(this);
accountManager.getUser()
}
Dependency Injection with Dagger 2
api.registerWithEmail(email, password, new Callback<RegisterResponse>() {
@Override
public void onResponse(Call<RegisterResponse> call, Response<RegisterResponse> response) {
if (response.isSuccess()) {
api.getUser(response.token, new Callback<User>() {
@Override
public void onResponse(Call<User> call, Response<User> response) {
if (response.isSuccess()) {}
database.saveUser()
} else {
showError(...);
}
}
@Override
public void onFailure(Call<User> call, Throwable t) {
showError(...);
}
});
} else {
if (ErrorResponse.isAlreadyRegistered(response.getErrorBody())) {
api.login(email, password, new Callback<LoginResponse>() {
@Override
public void onResponse(Call<LoginResponse> call, Response<LoginResponse> response) {
preferences.saveToken(response);
api.getUser(response.token, new Callback<User>() {
@Override
public void onResponse(Call<User> call, Response<User> response) {
RxAndroid
public Observable<UserInfo> registerAndLogin(String email, String password) {
return apiService.registerWithEmail(new RegisterRequest(email, password))
.flatMap(userInfo -> apiService.signInWithEmail(new SignInRequest(email, password)))
.doOnNext(signInResponse -> preferences.saveAccessToken(signInResponse.accessToken))
.onErrorResumeNext(e -> ErrorResponse.isAlreadyRegistered(e) ? apiService.signInWithEmail(new
SignInRequest(email, password)) : errorObservable(e))
.flatMap(ignore -> getUser())
.doOnNext(user -> database.saveUser(user));
}
RxAndroid
>> Improving UX with RX
RxAndroid
>> Thanks!
UPTech

Contenu connexe

Tendances

Event-Driven Systems With MongoDB
Event-Driven Systems With MongoDBEvent-Driven Systems With MongoDB
Event-Driven Systems With MongoDBAndrii Litvinov
 
End to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux SagaEnd to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux SagaBabacar NIANG
 
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017Mike Nakhimovich
 
Hidden-Web Induced by Client-Side Scripting: An Empirical Study
Hidden-Web Induced by Client-Side Scripting: An Empirical StudyHidden-Web Induced by Client-Side Scripting: An Empirical Study
Hidden-Web Induced by Client-Side Scripting: An Empirical StudySALT Lab @ UBC
 
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...MongoDB
 
Apache Incubator Samza: Stream Processing at LinkedIn
Apache Incubator Samza: Stream Processing at LinkedInApache Incubator Samza: Stream Processing at LinkedIn
Apache Incubator Samza: Stream Processing at LinkedInChris Riccomini
 
iOS Keychain by 흰, 민디
iOS Keychain by 흰, 민디iOS Keychain by 흰, 민디
iOS Keychain by 흰, 민디MINJICHO20
 
Understanding JavaScript Event-based Interactions
Understanding JavaScript Event-based InteractionsUnderstanding JavaScript Event-based Interactions
Understanding JavaScript Event-based InteractionsSALT Lab @ UBC
 
Parceable serializable
Parceable serializableParceable serializable
Parceable serializableSourabh Sahu
 
Integration solution with daxtra resume indexing
Integration solution with daxtra resume indexingIntegration solution with daxtra resume indexing
Integration solution with daxtra resume indexingAndy Yang
 
API Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API DocumentationAPI Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API DocumentationRouven Weßling
 
Automation in angular js
Automation in angular jsAutomation in angular js
Automation in angular jsMarcin Wosinek
 
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...Red Hat Developers
 
MongoDB.local Sydney: How and When to Use Multi-Document Distributed Transact...
MongoDB.local Sydney: How and When to Use Multi-Document Distributed Transact...MongoDB.local Sydney: How and When to Use Multi-Document Distributed Transact...
MongoDB.local Sydney: How and When to Use Multi-Document Distributed Transact...MongoDB
 
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1Toshiaki Maki
 
Integrando sistemas via OData (caso de estudiio GeneXus-SAP)
Integrando sistemas via OData (caso de estudiio GeneXus-SAP)Integrando sistemas via OData (caso de estudiio GeneXus-SAP)
Integrando sistemas via OData (caso de estudiio GeneXus-SAP)GeneXus
 

Tendances (20)

Event-Driven Systems With MongoDB
Event-Driven Systems With MongoDBEvent-Driven Systems With MongoDB
Event-Driven Systems With MongoDB
 
End to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux SagaEnd to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux Saga
 
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017
 
Hidden-Web Induced by Client-Side Scripting: An Empirical Study
Hidden-Web Induced by Client-Side Scripting: An Empirical StudyHidden-Web Induced by Client-Side Scripting: An Empirical Study
Hidden-Web Induced by Client-Side Scripting: An Empirical Study
 
RxSubject And Operators
RxSubject And OperatorsRxSubject And Operators
RxSubject And Operators
 
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
 
Apache Incubator Samza: Stream Processing at LinkedIn
Apache Incubator Samza: Stream Processing at LinkedInApache Incubator Samza: Stream Processing at LinkedIn
Apache Incubator Samza: Stream Processing at LinkedIn
 
iOS Keychain by 흰, 민디
iOS Keychain by 흰, 민디iOS Keychain by 흰, 민디
iOS Keychain by 흰, 민디
 
Understanding JavaScript Event-based Interactions
Understanding JavaScript Event-based InteractionsUnderstanding JavaScript Event-based Interactions
Understanding JavaScript Event-based Interactions
 
Retro vs volley (2)
Retro vs volley (2)Retro vs volley (2)
Retro vs volley (2)
 
Parceable serializable
Parceable serializableParceable serializable
Parceable serializable
 
Integration solution with daxtra resume indexing
Integration solution with daxtra resume indexingIntegration solution with daxtra resume indexing
Integration solution with daxtra resume indexing
 
API Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API DocumentationAPI Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API Documentation
 
Automation in angular js
Automation in angular jsAutomation in angular js
Automation in angular js
 
05 binding and action
05 binding and action05 binding and action
05 binding and action
 
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...
 
MongoDB.local Sydney: How and When to Use Multi-Document Distributed Transact...
MongoDB.local Sydney: How and When to Use Multi-Document Distributed Transact...MongoDB.local Sydney: How and When to Use Multi-Document Distributed Transact...
MongoDB.local Sydney: How and When to Use Multi-Document Distributed Transact...
 
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
 
ASP.NET WEB API
ASP.NET WEB APIASP.NET WEB API
ASP.NET WEB API
 
Integrando sistemas via OData (caso de estudiio GeneXus-SAP)
Integrando sistemas via OData (caso de estudiio GeneXus-SAP)Integrando sistemas via OData (caso de estudiio GeneXus-SAP)
Integrando sistemas via OData (caso de estudiio GeneXus-SAP)
 

En vedette

Generics. PECS
Generics. PECSGenerics. PECS
Generics. PECSUptech
 
Tuberculosis Pulmonar
Tuberculosis PulmonarTuberculosis Pulmonar
Tuberculosis PulmonarFAMEN
 
Beer Bottle Night Lamp
Beer Bottle Night LampBeer Bottle Night Lamp
Beer Bottle Night LampOmer Kilic
 
Clean architecture on Android
Clean architecture on AndroidClean architecture on Android
Clean architecture on AndroidGDG Odessa
 

En vedette (6)

Generics. PECS
Generics. PECSGenerics. PECS
Generics. PECS
 
4919_for_Ikoma
4919_for_Ikoma4919_for_Ikoma
4919_for_Ikoma
 
Tuberculosis Pulmonar
Tuberculosis PulmonarTuberculosis Pulmonar
Tuberculosis Pulmonar
 
COLOMBIA NUESTRA TIERRA
COLOMBIA NUESTRA TIERRACOLOMBIA NUESTRA TIERRA
COLOMBIA NUESTRA TIERRA
 
Beer Bottle Night Lamp
Beer Bottle Night LampBeer Bottle Night Lamp
Beer Bottle Night Lamp
 
Clean architecture on Android
Clean architecture on AndroidClean architecture on Android
Clean architecture on Android
 

Similaire à Android getting started

可抽換元件設計模式
可抽換元件設計模式可抽換元件設計模式
可抽換元件設計模式Pete Chen
 
Dagger 2 - Injeção de Dependência
Dagger 2 - Injeção de DependênciaDagger 2 - Injeção de Dependência
Dagger 2 - Injeção de DependênciaEdson Menegatti
 
API 통신, Retrofit 대신 Ktor 어떠신가요.pdf
API 통신, Retrofit 대신 Ktor 어떠신가요.pdfAPI 통신, Retrofit 대신 Ktor 어떠신가요.pdf
API 통신, Retrofit 대신 Ktor 어떠신가요.pdfssuserb6c2641
 
Sharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SFSharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SFPierre-Yves Ricau
 
Nestjs MasterClass Slides
Nestjs MasterClass SlidesNestjs MasterClass Slides
Nestjs MasterClass SlidesNir Kaufman
 
Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02rhemsolutions
 
Jug Guice Presentation
Jug Guice PresentationJug Guice Presentation
Jug Guice PresentationDmitry Buzdin
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android InfrastructureAlexey Buzdin
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android InfrastructureC.T.Co
 
Rapid development tools for java ee 8 [tut2998]
Rapid development tools for java ee 8 [tut2998]Rapid development tools for java ee 8 [tut2998]
Rapid development tools for java ee 8 [tut2998]Payara
 
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneBang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneDroidConTLV
 
Rapid Development Tools for Java EE 8 [TUT2998]
Rapid Development Tools for Java EE 8 [TUT2998]Rapid Development Tools for Java EE 8 [TUT2998]
Rapid Development Tools for Java EE 8 [TUT2998]Gaurav Gupta
 
Android Bootstrap
Android BootstrapAndroid Bootstrap
Android Bootstrapdonnfelker
 
Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stackTomáš Kypta
 
Spca2014 hillier build your_own_rest_service
Spca2014 hillier build your_own_rest_serviceSpca2014 hillier build your_own_rest_service
Spca2014 hillier build your_own_rest_serviceNCCOMMS
 
Retrofit 2 - O que devemos saber
Retrofit 2 - O que devemos saberRetrofit 2 - O que devemos saber
Retrofit 2 - O que devemos saberBruno Vieira
 
The lazy programmers guide to consuming web services
The lazy programmers guide to consuming web services The lazy programmers guide to consuming web services
The lazy programmers guide to consuming web services mamnun
 

Similaire à Android getting started (20)

可抽換元件設計模式
可抽換元件設計模式可抽換元件設計模式
可抽換元件設計模式
 
Dagger 2 - Injeção de Dependência
Dagger 2 - Injeção de DependênciaDagger 2 - Injeção de Dependência
Dagger 2 - Injeção de Dependência
 
API 통신, Retrofit 대신 Ktor 어떠신가요.pdf
API 통신, Retrofit 대신 Ktor 어떠신가요.pdfAPI 통신, Retrofit 대신 Ktor 어떠신가요.pdf
API 통신, Retrofit 대신 Ktor 어떠신가요.pdf
 
Sharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SFSharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SF
 
Nestjs MasterClass Slides
Nestjs MasterClass SlidesNestjs MasterClass Slides
Nestjs MasterClass Slides
 
Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02
 
Jug Guice Presentation
Jug Guice PresentationJug Guice Presentation
Jug Guice Presentation
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
 
Rapid development tools for java ee 8 [tut2998]
Rapid development tools for java ee 8 [tut2998]Rapid development tools for java ee 8 [tut2998]
Rapid development tools for java ee 8 [tut2998]
 
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneBang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
 
Rapid Development Tools for Java EE 8 [TUT2998]
Rapid Development Tools for Java EE 8 [TUT2998]Rapid Development Tools for Java EE 8 [TUT2998]
Rapid Development Tools for Java EE 8 [TUT2998]
 
Android Bootstrap
Android BootstrapAndroid Bootstrap
Android Bootstrap
 
Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stack
 
Codemotion appengine
Codemotion appengineCodemotion appengine
Codemotion appengine
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
Spca2014 hillier build your_own_rest_service
Spca2014 hillier build your_own_rest_serviceSpca2014 hillier build your_own_rest_service
Spca2014 hillier build your_own_rest_service
 
Android development
Android developmentAndroid development
Android development
 
Retrofit 2 - O que devemos saber
Retrofit 2 - O que devemos saberRetrofit 2 - O que devemos saber
Retrofit 2 - O que devemos saber
 
The lazy programmers guide to consuming web services
The lazy programmers guide to consuming web services The lazy programmers guide to consuming web services
The lazy programmers guide to consuming web services
 

Plus de Uptech

Android studio 2.2 Tips and Tricks
Android studio 2.2 Tips and TricksAndroid studio 2.2 Tips and Tricks
Android studio 2.2 Tips and TricksUptech
 
Scrum. A brief introduction
Scrum. A brief introductionScrum. A brief introduction
Scrum. A brief introductionUptech
 
App coordinators in iOS
App coordinators in iOSApp coordinators in iOS
App coordinators in iOSUptech
 
Ruby language overview
Ruby language overviewRuby language overview
Ruby language overviewUptech
 
Getting things done intro
Getting things done introGetting things done intro
Getting things done introUptech
 
Mvp tech talks
Mvp tech talksMvp tech talks
Mvp tech talksUptech
 

Plus de Uptech (6)

Android studio 2.2 Tips and Tricks
Android studio 2.2 Tips and TricksAndroid studio 2.2 Tips and Tricks
Android studio 2.2 Tips and Tricks
 
Scrum. A brief introduction
Scrum. A brief introductionScrum. A brief introduction
Scrum. A brief introduction
 
App coordinators in iOS
App coordinators in iOSApp coordinators in iOS
App coordinators in iOS
 
Ruby language overview
Ruby language overviewRuby language overview
Ruby language overview
 
Getting things done intro
Getting things done introGetting things done intro
Getting things done intro
 
Mvp tech talks
Mvp tech talksMvp tech talks
Mvp tech talks
 

Dernier

CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 

Dernier (20)

CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 

Android getting started

  • 2. What’s on the list? Basic Libraries Dependency Injection with Dagger 2 RxAndroid Custom Views FTW The Future: Kotlin
  • 3. Basic Libraries Butterknife Retrolambda REST Trio: Retrofit, OkHttp, Gson Image Loading: Glide, Fresco Realm
  • 4. Dependency Injection with Dagger 2 class ApiService { public void uploadPhoto(String user, File file) { OkHttpClient client = new OkHttpClient(); Gson gson = new Gson(); Request request = // TODO build a post request client.newCall(request).execute(); } }
  • 5. Dependency Injection with Dagger 2 class ApiService { Gson gson = new Gson(); OkHttpClient client = new OkHttpClient() public void uploadPhoto(String user, File file) { Request request = // TODO build a post request client.newCall(request).execute(); } }
  • 6. Dependency Injection with Dagger 2 class ApiService { Gson gson; OkHttpClient client; public ApiService(OkHttpClient client, Gson gson) { this.client = client; this.gson = gson; } public void uploadPhoto(String user, File file) { Request request = // TODO build a post request client.newCall(request).execute(); } }
  • 7. Dependency Injection with Dagger 2 OkHttpClient client = new OkHttpClient(); Gson gson = new Gson(); ApiService apiService = new ApiService(client, gson); apiService.uploadPhoto("UPTechTeam", file);
  • 9. OkHttpClient client = new OkHttpClient(); Gson gson = new Gson(); ApiService apiService = new ApiService(client, gson); RealmConfiguration config = new RealmConfiguration.Builder(context) .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(config); Realm realm = Realm.getDefaultInstance(); Preferences preferences = new Preferences(context); AccountManager accountManager = new AccountManager(apiService, database, preferences); accountManager.getUser(); Dependency Injection
  • 10. @Inject AccountManager accountManager; @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); Application.appComponent().inject(this); accountManager.getUser() } Dependency Injection with Dagger 2
  • 11. api.registerWithEmail(email, password, new Callback<RegisterResponse>() { @Override public void onResponse(Call<RegisterResponse> call, Response<RegisterResponse> response) { if (response.isSuccess()) { api.getUser(response.token, new Callback<User>() { @Override public void onResponse(Call<User> call, Response<User> response) { if (response.isSuccess()) {} database.saveUser() } else { showError(...); } } @Override public void onFailure(Call<User> call, Throwable t) { showError(...); } }); } else { if (ErrorResponse.isAlreadyRegistered(response.getErrorBody())) { api.login(email, password, new Callback<LoginResponse>() { @Override public void onResponse(Call<LoginResponse> call, Response<LoginResponse> response) { preferences.saveToken(response); api.getUser(response.token, new Callback<User>() { @Override public void onResponse(Call<User> call, Response<User> response) { RxAndroid
  • 12. public Observable<UserInfo> registerAndLogin(String email, String password) { return apiService.registerWithEmail(new RegisterRequest(email, password)) .flatMap(userInfo -> apiService.signInWithEmail(new SignInRequest(email, password))) .doOnNext(signInResponse -> preferences.saveAccessToken(signInResponse.accessToken)) .onErrorResumeNext(e -> ErrorResponse.isAlreadyRegistered(e) ? apiService.signInWithEmail(new SignInRequest(email, password)) : errorObservable(e)) .flatMap(ignore -> getUser()) .doOnNext(user -> database.saveUser(user)); } RxAndroid
  • 13. >> Improving UX with RX RxAndroid