SlideShare a Scribd company logo
The Best Way to Become an Android Developer
Expert
with Android Jetpack
Ahmad Arif Faizin
Academy Content Writer at Dicoding
Do You Know?
Let’s Listen
Their Story
dicoding.id/junia
dicoding.id/junia
dicoding.id/junia
dicoding.id/junia
dicoding.id/rosy
dicoding.id/rosy
dicoding.id/hastu
dicoding.id/hastu
dicoding.id/hastu
What
about us?
How to be
Developers?
Jetpack?
Kiri, Kanan, L1, L2, R1, R2, Atas,
Bawah, Kiri, Kanan
Android Jetpack
Jetpack is a collection of Android software
components to make it easier for you to develop
great Android apps.
Advantages
Accelerate development
Eliminate boilerplate code
Build high quality, robust apps
Layouting
LinearLayout ConstraintLayout RelativeLayout GridLayout ScrollView
Constraint Layout VS Other Layout
Passing Data
between Activity
Activity vs Fragment
Navigation
Using Library to Load Image
GlidePicasso
Pro Tips!
Android Debugging
First Step...
+
=
Android Networking - get data from API
Fast Android
Networking
Retrofit
Volley AQuery
Behavior - NotificationsReply & Deep Link action, Bubble, Interruptive & Gentle Notification
Status bar and notification drawer Heads-up notification
Notification
Channel
On and above Android 8.0 (Oreo)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel(
CHANNEL_ID,
CHANNEL_NAME,
NotificationManager.IMPORTANCE_DEFAULT)
mBuilder.setChannelId(CHANNEL_ID)
mNotificationManager.createNotificationChannel(channel)
}
Behavior - PermissionsCompatibility APIs for checking and requesting app permissions
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.snazzyapp">
<uses-permission android:name="android.permission.SEND_SMS"/>
<application ...>
...
</application>
</manifest>
if (ContextCompat.checkSelfPermission(thisActivity,
Manifest.permission.READ_CONTACTS)
!= PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(thisActivity,
Manifest.permission.READ_CONTACTS)) {
} else {
ActivityCompat.requestPermissions(thisActivity,
new String[]{Manifest.permission.READ_CONTACTS},
MY_PERMISSIONS_REQUEST_READ_CONTACTS);
}
} else {
// Permission has already been granted
}
Request Permission Flow
Permissions.check(this/*context*/, Manifest.permission.CALL_PHONE, null, new PermissionHandler() {
@Override
public void onGranted() {
// do your task.
}
});
Pro Tips!
Permission using Library
Android Permissions
https://github.com/nabinbhandari/Android-Permissions
Behavior - PreferencesCreate interactive settings screens
<androidx.preference.PreferenceScreen
xmlns:app="http://schemas.android.com/apk/res-auto">
<SwitchPreferenceCompat
app:key="notifications"
app:title="Enable message notifications"/>
<Preference
app:key="feedback"
app:title="Send feedback"
app:summary="Report technical issues or suggest new features"/>
</androidx.preference.PreferenceScreen>
Data Persistence
Foundation - TestingAn Android testing framework for unit and runtime UI tests
Foundation - TestingAn Android testing framework for unit and runtime UI tests
Foundation - Unit Test
Getting Started
dependencies {
// Required -- JUnit 4 framework
testImplementation 'junit:junit:4.12'
// Optional -- Robolectric environment
testImplementation 'androidx.test:core:1.0.0'
// Optional -- Mockito framework
testImplementation 'org.mockito:mockito-core:1.10.19'
}
Foundation - Instrumental Testing
Getting Started
dependencies {
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.0'
// Optional -- Hamcrest library
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
// Optional -- UI testing with Espresso
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
// Optional -- UI testing with UI Automator
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
}
Pro Tips!
Architecture Pattern
Architecture Pattern
● Maintainability
● Testability
● Extensibility
Architecture Component
Lifecycle - ViewModel - LiveData -Room
Repository
Benefit
Architecture - ViewModelManage UI-related data in a lifecycle-conscious way
Architecture - LiveData
Ensures your UI matches your data state
No memory leaks
No crashes due to stopped activities
No more manual lifecycle handling
Always up to date data
Proper configuration changes
Sharing resources
Notify views when underlying database changes
Architecture - LiveData
public class NameViewModel extends ViewModel {
// Create a LiveData with a String
private MutableLiveData<String> currentName;
public MutableLiveData<String> getCurrentName() {
if (currentName == null) {
currentName = new MutableLiveData<String>();
}
return currentName;
}
// Rest of the ViewModel...
}
Notify views when underlying database changes
public class NameActivity extends AppCompatActivity {
private NameViewModel model;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Other code to setup the activity...
// Get the ViewModel.
model = ViewModelProviders.of(this).get(NameViewModel.class);
// Create the observer which updates the UI.
final Observer<String> nameObserver = new Observer<String>() {
@Override
public void onChanged(@Nullable final String newName) {
// Update the UI, in this case, a TextView.
nameTextView.setText(newName);
}
};
// Observe the LiveData, passing in this activity as the LifecycleOwner and the observer.
model.getCurrentName().observe(this, nameObserver);
}
}
Architecture - RoomFluent SQLite database access
SQLite Vs Room
Create database table
@Entity
public class User {
@PrimaryKey
public int uid;
@ColumnInfo(name = "first_name")
public String firstName;
@ColumnInfo(name = "last_name")
public String lastName;
}
private static final String
WORD_LIST_TABLE_CREATE =
"CREATE TABLE " +WORD_LIST_TABLE + "
(" + UID + " INTEGER PRIMARY KEY, " +
FIRST_NAME + " TEXT, ” + LAST_NAME + "
TEXT );";
Architecture - RoomEntity
@Entity
public class User {
@PrimaryKey
public int uid;
@ColumnInfo(name = "first_name")
public String firstName;
@ColumnInfo(name = "last_name")
public String lastName;
}
Architecture - RoomDao
@Dao
public interface UserDao {
@Query("SELECT * FROM user")
List<User> getAll();
@Query("SELECT * FROM user WHERE uid IN (:userIds)")
List<User> loadAllByIds(int[] userIds);
@Query("SELECT * FROM user WHERE first_name LIKE :first AND " + "last_name LIKE :last LIMIT 1")
User findByName(String first, String last);
@Insert
void insertAll(User... users);
@Delete
void delete(User user);
}
Architecture - RoomDatabase
@Database(entities = {User.class}, version = 1)
public abstract class AppDatabase extends RoomDatabase {
public abstract UserDao userDao();
}
Create Database
AppDatabase db = Room.databaseBuilder(getApplicationContext(),
AppDatabase.class, "database-name").build();
Architecture - PagingGradually load information on demand from your data source
Architecture - PagingGradually load information on demand from your data source
DataSource
@Dao
public interface ConcertDao {
// The Integer type parameter tells Room to use a
// PositionalDataSource object.
@Query("SELECT * FROM concerts ORDER BY date DESC")
DataSource.Factory<Integer, Concert> concertsByDate();
}
Architecture - PagingGradually load information on demand from your data source
PagedList
public class ConcertViewModel extends ViewModel {
private ConcertDao concertDao;
public final LiveData<PagedList<Concert>> concertList;
// Creates a PagedList object with 50 items per page.
public ConcertViewModel(ConcertDao concertDao) {
this.concertDao = concertDao;
concertList = new LivePagedListBuilder<>(
concertDao.concertsByDate(), 50).build();
}
}
Architecture - PagingGradually load information on demand from your data source
UI
public class BookmarkPagedAdapter extends PagedListAdapter<DataModel, ViewHolder> {
...
}
Architecture - WorkManagerBest practice to handling background process
Architecture - WorkManager
public class UploadWorker extends Worker {
public UploadWorker(@NonNull Context context, @NonNull WorkerParameters params) {
super(context, params);
}
@Override
public Result doWork() {
// Do the work here--in this case, upload the images.
uploadImages()
// Indicate whether the task finished successfully with the Result
return Result.success()
}
}
Manage your Android background jobs
Architecture - WorkManager
OneTimeWorkRequest
OneTimeWorkRequest uploadWorkRequest = new OneTimeWorkRequest.Builder(UploadWorker.class).build()
PeriodicWorkRequest
Constraints constraints = new Constraints.Builder().setRequiresCharging(true).build();
PeriodicWorkRequest saveRequest = new PeriodicWorkRequest.Builder(SaveImageFileWorker.class, 1,
TimeUnit.HOURS).setConstraints(constraints).build();
WorkManager.getInstance().enqueue(saveRequest);
Manage your Android background jobs
Architecture - WorkManagerManage your Android background jobs
WorkContinuation chain1 = WorkManager.getInstance()
.beginWith(workA)
.then(workB);
WorkContinuation chain2 = WorkManager.getInstance()
.beginWith(workC)
.then(workD);
WorkContinuation chain3 = WorkContinuation
.combine(Arrays.asList(chain1, chain2))
.then(workE);
chain3.enqueue();
Documentation
g.co/jetpack
Try Sample App
https://github.com/googlesamples/
android-sunflower
What’s next?
Bimbingan
Project
Sertifikat / Sertifikasi
Kebutuhan
Industri IT
Talenta
Digital
Lulusan universitas
Lulusan SMK
Otodidak
Kursus
Profesional
dll (re-skilling)
Training /
Matrikulasi
Sertifikasi
https://idcamp.indosatooredoo.com/
VS
—IMAM SYAFI’I
Jika kamu tidak sanggup
menahan lelahnya belajar
maka kamu harus sanggup
menahan perihnya kebodohan
Thank You...
97
Ahmad Arif Faizin
0857 4048 2440
@arif_faizin
arif@dicoding.com

More Related Content

What's hot

Recap of Android Dev Summit 2018
Recap of Android Dev Summit 2018Recap of Android Dev Summit 2018
Recap of Android Dev Summit 2018
Hassan Abid
 
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
Dicoding
 
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Get Hip with JHipster - Colorado Springs Open Source User Group 2021Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Matt Raible
 
How to Contribute to Apache Usergrid
How to Contribute to Apache UsergridHow to Contribute to Apache Usergrid
How to Contribute to Apache Usergrid
David M. Johnson
 
Get Hip with JHipster - GIDS 2019
Get Hip with JHipster - GIDS 2019Get Hip with JHipster - GIDS 2019
Get Hip with JHipster - GIDS 2019
Matt Raible
 
React Native Androidはなぜ動くのか
React Native Androidはなぜ動くのかReact Native Androidはなぜ動くのか
React Native Androidはなぜ動くのか
Yukiya Nakagawa
 
Opensocial Haifa Seminar - 2008.04.08
Opensocial Haifa Seminar - 2008.04.08Opensocial Haifa Seminar - 2008.04.08
Opensocial Haifa Seminar - 2008.04.08Ari Leichtberg
 
I/O Extended (GDG Bogor) - Andrew Kurniadi
I/O Extended (GDG Bogor) - Andrew KurniadiI/O Extended (GDG Bogor) - Andrew Kurniadi
I/O Extended (GDG Bogor) - Andrew Kurniadi
Dicoding
 
Android App Development using HTML5 Technology
Android App Development using HTML5 TechnologyAndroid App Development using HTML5 Technology
Android App Development using HTML5 Technology
Oon Arfiandwi
 
Ajaxworld Opensocial Presentation
Ajaxworld Opensocial PresentationAjaxworld Opensocial Presentation
Ajaxworld Opensocial Presentation
Chris Schalk
 
Microservices for the Masses with Spring Boot, JHipster and OAuth - GIDS 2019
Microservices for the Masses with Spring Boot, JHipster and OAuth - GIDS 2019Microservices for the Masses with Spring Boot, JHipster and OAuth - GIDS 2019
Microservices for the Masses with Spring Boot, JHipster and OAuth - GIDS 2019
Matt Raible
 
Google App Engine for Python - Unit01: Basic
Google App Engine for Python - Unit01: BasicGoogle App Engine for Python - Unit01: Basic
Google App Engine for Python - Unit01: Basic
Wei-Tsung Su
 
Introduction in the play framework
Introduction in the play frameworkIntroduction in the play framework
Introduction in the play framework
Alexander Reelsen
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
Chiew Carol
 
Atomic Designは「マルチ」で真価を発揮する
Atomic Designは「マルチ」で真価を発揮するAtomic Designは「マルチ」で真価を発揮する
Atomic Designは「マルチ」で真価を発揮する
Yukiya Nakagawa
 
Webdriver with Thucydides - TdT@Cluj #18
Webdriver with Thucydides - TdT@Cluj #18Webdriver with Thucydides - TdT@Cluj #18
Webdriver with Thucydides - TdT@Cluj #18
Tabăra de Testare
 
React Native
React NativeReact Native
React Native
Fatih Şimşek
 
Андрей Саксонов «Разработка плагинов для Atlassian JIRA»
Андрей Саксонов «Разработка плагинов для Atlassian JIRA»Андрей Саксонов «Разработка плагинов для Atlassian JIRA»
Андрей Саксонов «Разработка плагинов для Atlassian JIRA»DataArt
 
Звиад Кардава "Android Things + Google Weave"
Звиад Кардава "Android Things + Google Weave" Звиад Кардава "Android Things + Google Weave"
Звиад Кардава "Android Things + Google Weave"
IT Event
 

What's hot (20)

Recap of Android Dev Summit 2018
Recap of Android Dev Summit 2018Recap of Android Dev Summit 2018
Recap of Android Dev Summit 2018
 
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
 
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Get Hip with JHipster - Colorado Springs Open Source User Group 2021Get Hip with JHipster - Colorado Springs Open Source User Group 2021
Get Hip with JHipster - Colorado Springs Open Source User Group 2021
 
How to Contribute to Apache Usergrid
How to Contribute to Apache UsergridHow to Contribute to Apache Usergrid
How to Contribute to Apache Usergrid
 
Get Hip with JHipster - GIDS 2019
Get Hip with JHipster - GIDS 2019Get Hip with JHipster - GIDS 2019
Get Hip with JHipster - GIDS 2019
 
React Native Androidはなぜ動くのか
React Native Androidはなぜ動くのかReact Native Androidはなぜ動くのか
React Native Androidはなぜ動くのか
 
Opensocial Haifa Seminar - 2008.04.08
Opensocial Haifa Seminar - 2008.04.08Opensocial Haifa Seminar - 2008.04.08
Opensocial Haifa Seminar - 2008.04.08
 
I/O Extended (GDG Bogor) - Andrew Kurniadi
I/O Extended (GDG Bogor) - Andrew KurniadiI/O Extended (GDG Bogor) - Andrew Kurniadi
I/O Extended (GDG Bogor) - Andrew Kurniadi
 
Android App Development using HTML5 Technology
Android App Development using HTML5 TechnologyAndroid App Development using HTML5 Technology
Android App Development using HTML5 Technology
 
Ajaxworld Opensocial Presentation
Ajaxworld Opensocial PresentationAjaxworld Opensocial Presentation
Ajaxworld Opensocial Presentation
 
Stmik bandung
Stmik bandungStmik bandung
Stmik bandung
 
Microservices for the Masses with Spring Boot, JHipster and OAuth - GIDS 2019
Microservices for the Masses with Spring Boot, JHipster and OAuth - GIDS 2019Microservices for the Masses with Spring Boot, JHipster and OAuth - GIDS 2019
Microservices for the Masses with Spring Boot, JHipster and OAuth - GIDS 2019
 
Google App Engine for Python - Unit01: Basic
Google App Engine for Python - Unit01: BasicGoogle App Engine for Python - Unit01: Basic
Google App Engine for Python - Unit01: Basic
 
Introduction in the play framework
Introduction in the play frameworkIntroduction in the play framework
Introduction in the play framework
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
 
Atomic Designは「マルチ」で真価を発揮する
Atomic Designは「マルチ」で真価を発揮するAtomic Designは「マルチ」で真価を発揮する
Atomic Designは「マルチ」で真価を発揮する
 
Webdriver with Thucydides - TdT@Cluj #18
Webdriver with Thucydides - TdT@Cluj #18Webdriver with Thucydides - TdT@Cluj #18
Webdriver with Thucydides - TdT@Cluj #18
 
React Native
React NativeReact Native
React Native
 
Андрей Саксонов «Разработка плагинов для Atlassian JIRA»
Андрей Саксонов «Разработка плагинов для Atlassian JIRA»Андрей Саксонов «Разработка плагинов для Atlassian JIRA»
Андрей Саксонов «Разработка плагинов для Atlassian JIRA»
 
Звиад Кардава "Android Things + Google Weave"
Звиад Кардава "Android Things + Google Weave" Звиад Кардава "Android Things + Google Weave"
Звиад Кардава "Android Things + Google Weave"
 

Similar to The Best Way to Become an Android Developer Expert with Android Jetpack

Android Jetpack - Google IO Extended Singapore 2018
Android Jetpack - Google IO Extended Singapore 2018Android Jetpack - Google IO Extended Singapore 2018
Android Jetpack - Google IO Extended Singapore 2018
Hassan Abid
 
Building Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture ComponentsBuilding Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture Components
Hassan Abid
 
Android Architecture Components - Guy Bar on, Vonage
Android Architecture Components - Guy Bar on, VonageAndroid Architecture Components - Guy Bar on, Vonage
Android Architecture Components - Guy Bar on, Vonage
DroidConTLV
 
Java Technology
Java TechnologyJava Technology
Java Technologyifnu bima
 
Data access
Data accessData access
Data access
Joshua Yoon
 
Architecture components - IT Talk
Architecture components - IT TalkArchitecture components - IT Talk
Architecture components - IT Talk
Constantine Mars
 
Architecture Components
Architecture Components Architecture Components
Architecture Components
DataArt
 
Android best practices
Android best practicesAndroid best practices
Android best practices
Jose Manuel Ortega Candel
 
Hexagonal architecture in PHP
Hexagonal architecture in PHPHexagonal architecture in PHP
Hexagonal architecture in PHP
Paulo Victor Gomes
 
From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)
Jose Manuel Pereira Garcia
 
Cross-Platform Native Mobile Development with Eclipse
Cross-Platform Native Mobile Development with EclipseCross-Platform Native Mobile Development with Eclipse
Cross-Platform Native Mobile Development with Eclipse
Peter Friese
 
Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15
Murat Yener
 
Advanced Web Development
Advanced Web DevelopmentAdvanced Web Development
Advanced Web Development
Robert J. Stein
 
Organizing the Data Chaos of Scientists
Organizing the Data Chaos of ScientistsOrganizing the Data Chaos of Scientists
Organizing the Data Chaos of Scientists
Andreas Schreiber
 
DataFinder: A Python Application for Scientific Data Management
DataFinder: A Python Application for Scientific Data ManagementDataFinder: A Python Application for Scientific Data Management
DataFinder: A Python Application for Scientific Data Management
Andreas Schreiber
 
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NCAndroid Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NCJim Tochterman
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WAREFermin Galan
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...Fabio Franzini
 
My way to clean android (EN) - Android day salamanca edition
My way to clean android (EN) - Android day salamanca editionMy way to clean android (EN) - Android day salamanca edition
My way to clean android (EN) - Android day salamanca edition
Christian Panadero
 

Similar to The Best Way to Become an Android Developer Expert with Android Jetpack (20)

Android Jetpack - Google IO Extended Singapore 2018
Android Jetpack - Google IO Extended Singapore 2018Android Jetpack - Google IO Extended Singapore 2018
Android Jetpack - Google IO Extended Singapore 2018
 
Building Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture ComponentsBuilding Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture Components
 
Android Architecture Components - Guy Bar on, Vonage
Android Architecture Components - Guy Bar on, VonageAndroid Architecture Components - Guy Bar on, Vonage
Android Architecture Components - Guy Bar on, Vonage
 
Java Technology
Java TechnologyJava Technology
Java Technology
 
Data access
Data accessData access
Data access
 
Architecture components - IT Talk
Architecture components - IT TalkArchitecture components - IT Talk
Architecture components - IT Talk
 
Architecture Components
Architecture Components Architecture Components
Architecture Components
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 
Android best practices
Android best practicesAndroid best practices
Android best practices
 
Hexagonal architecture in PHP
Hexagonal architecture in PHPHexagonal architecture in PHP
Hexagonal architecture in PHP
 
From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)
 
Cross-Platform Native Mobile Development with Eclipse
Cross-Platform Native Mobile Development with EclipseCross-Platform Native Mobile Development with Eclipse
Cross-Platform Native Mobile Development with Eclipse
 
Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15
 
Advanced Web Development
Advanced Web DevelopmentAdvanced Web Development
Advanced Web Development
 
Organizing the Data Chaos of Scientists
Organizing the Data Chaos of ScientistsOrganizing the Data Chaos of Scientists
Organizing the Data Chaos of Scientists
 
DataFinder: A Python Application for Scientific Data Management
DataFinder: A Python Application for Scientific Data ManagementDataFinder: A Python Application for Scientific Data Management
DataFinder: A Python Application for Scientific Data Management
 
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NCAndroid Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
Android Development w/ ArcGIS Server - Esri Dev Meetup - Charlotte, NC
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
My way to clean android (EN) - Android day salamanca edition
My way to clean android (EN) - Android day salamanca editionMy way to clean android (EN) - Android day salamanca edition
My way to clean android (EN) - Android day salamanca edition
 

More from Ahmad Arif Faizin

Guideline Submission GitHub BFAA Dicoding
Guideline Submission GitHub BFAA DicodingGuideline Submission GitHub BFAA Dicoding
Guideline Submission GitHub BFAA Dicoding
Ahmad Arif Faizin
 
Proker Departemen Dakwah dan Syiar 2013.pptx
Proker Departemen Dakwah dan Syiar 2013.pptxProker Departemen Dakwah dan Syiar 2013.pptx
Proker Departemen Dakwah dan Syiar 2013.pptx
Ahmad Arif Faizin
 
DKM_2013_BISMILLAH.pptx
DKM_2013_BISMILLAH.pptxDKM_2013_BISMILLAH.pptx
DKM_2013_BISMILLAH.pptx
Ahmad Arif Faizin
 
Proker bendahara al muhandis 2013.ppt
Proker bendahara al muhandis 2013.pptProker bendahara al muhandis 2013.ppt
Proker bendahara al muhandis 2013.ppt
Ahmad Arif Faizin
 
PPT raker EKONOMI 2013.pptx
PPT raker EKONOMI 2013.pptxPPT raker EKONOMI 2013.pptx
PPT raker EKONOMI 2013.pptx
Ahmad Arif Faizin
 
Program Kerja Kaderisasi Al Muhandis 2013
Program Kerja Kaderisasi Al Muhandis 2013Program Kerja Kaderisasi Al Muhandis 2013
Program Kerja Kaderisasi Al Muhandis 2013
Ahmad Arif Faizin
 
Departemen Mentoring.pptx
Departemen Mentoring.pptxDepartemen Mentoring.pptx
Departemen Mentoring.pptx
Ahmad Arif Faizin
 
ANNISAA' 2013.pptx
ANNISAA' 2013.pptxANNISAA' 2013.pptx
ANNISAA' 2013.pptx
Ahmad Arif Faizin
 
PPT KKN PEDURUNGAN 2016.pptx
PPT KKN PEDURUNGAN 2016.pptxPPT KKN PEDURUNGAN 2016.pptx
PPT KKN PEDURUNGAN 2016.pptx
Ahmad Arif Faizin
 
Absis UNBK.pptx
Absis UNBK.pptxAbsis UNBK.pptx
Absis UNBK.pptx
Ahmad Arif Faizin
 
Dts x dicoding #5 memulai pemrograman kotlin
Dts x dicoding #5 memulai pemrograman kotlinDts x dicoding #5 memulai pemrograman kotlin
Dts x dicoding #5 memulai pemrograman kotlin
Ahmad Arif Faizin
 
Dts x dicoding #4 memulai pemrograman kotlin
Dts x dicoding #4 memulai pemrograman kotlinDts x dicoding #4 memulai pemrograman kotlin
Dts x dicoding #4 memulai pemrograman kotlin
Ahmad Arif Faizin
 
Dts x dicoding #3 memulai pemrograman kotlin
Dts x dicoding #3 memulai pemrograman kotlinDts x dicoding #3 memulai pemrograman kotlin
Dts x dicoding #3 memulai pemrograman kotlin
Ahmad Arif Faizin
 
Dts x dicoding #2 memulai pemrograman kotlin
Dts x dicoding #2 memulai pemrograman kotlinDts x dicoding #2 memulai pemrograman kotlin
Dts x dicoding #2 memulai pemrograman kotlin
Ahmad Arif Faizin
 
Dts x dicoding #1 memulai pemrograman kotlin
Dts x dicoding #1 memulai pemrograman kotlinDts x dicoding #1 memulai pemrograman kotlin
Dts x dicoding #1 memulai pemrograman kotlin
Ahmad Arif Faizin
 
Dsc how google programs make great developer
Dsc how google programs make great developerDsc how google programs make great developer
Dsc how google programs make great developer
Ahmad Arif Faizin
 
First Gathering Sandec
First Gathering SandecFirst Gathering Sandec
First Gathering Sandec
Ahmad Arif Faizin
 
Mockup Android Application Template Library
Mockup Android Application Template LibraryMockup Android Application Template Library
Mockup Android Application Template Library
Ahmad Arif Faizin
 
Mockup Android Application : Go bon
Mockup Android Application : Go bonMockup Android Application : Go bon
Mockup Android Application : Go bon
Ahmad Arif Faizin
 
Lomba Sayembara Logo
Lomba Sayembara LogoLomba Sayembara Logo
Lomba Sayembara Logo
Ahmad Arif Faizin
 

More from Ahmad Arif Faizin (20)

Guideline Submission GitHub BFAA Dicoding
Guideline Submission GitHub BFAA DicodingGuideline Submission GitHub BFAA Dicoding
Guideline Submission GitHub BFAA Dicoding
 
Proker Departemen Dakwah dan Syiar 2013.pptx
Proker Departemen Dakwah dan Syiar 2013.pptxProker Departemen Dakwah dan Syiar 2013.pptx
Proker Departemen Dakwah dan Syiar 2013.pptx
 
DKM_2013_BISMILLAH.pptx
DKM_2013_BISMILLAH.pptxDKM_2013_BISMILLAH.pptx
DKM_2013_BISMILLAH.pptx
 
Proker bendahara al muhandis 2013.ppt
Proker bendahara al muhandis 2013.pptProker bendahara al muhandis 2013.ppt
Proker bendahara al muhandis 2013.ppt
 
PPT raker EKONOMI 2013.pptx
PPT raker EKONOMI 2013.pptxPPT raker EKONOMI 2013.pptx
PPT raker EKONOMI 2013.pptx
 
Program Kerja Kaderisasi Al Muhandis 2013
Program Kerja Kaderisasi Al Muhandis 2013Program Kerja Kaderisasi Al Muhandis 2013
Program Kerja Kaderisasi Al Muhandis 2013
 
Departemen Mentoring.pptx
Departemen Mentoring.pptxDepartemen Mentoring.pptx
Departemen Mentoring.pptx
 
ANNISAA' 2013.pptx
ANNISAA' 2013.pptxANNISAA' 2013.pptx
ANNISAA' 2013.pptx
 
PPT KKN PEDURUNGAN 2016.pptx
PPT KKN PEDURUNGAN 2016.pptxPPT KKN PEDURUNGAN 2016.pptx
PPT KKN PEDURUNGAN 2016.pptx
 
Absis UNBK.pptx
Absis UNBK.pptxAbsis UNBK.pptx
Absis UNBK.pptx
 
Dts x dicoding #5 memulai pemrograman kotlin
Dts x dicoding #5 memulai pemrograman kotlinDts x dicoding #5 memulai pemrograman kotlin
Dts x dicoding #5 memulai pemrograman kotlin
 
Dts x dicoding #4 memulai pemrograman kotlin
Dts x dicoding #4 memulai pemrograman kotlinDts x dicoding #4 memulai pemrograman kotlin
Dts x dicoding #4 memulai pemrograman kotlin
 
Dts x dicoding #3 memulai pemrograman kotlin
Dts x dicoding #3 memulai pemrograman kotlinDts x dicoding #3 memulai pemrograman kotlin
Dts x dicoding #3 memulai pemrograman kotlin
 
Dts x dicoding #2 memulai pemrograman kotlin
Dts x dicoding #2 memulai pemrograman kotlinDts x dicoding #2 memulai pemrograman kotlin
Dts x dicoding #2 memulai pemrograman kotlin
 
Dts x dicoding #1 memulai pemrograman kotlin
Dts x dicoding #1 memulai pemrograman kotlinDts x dicoding #1 memulai pemrograman kotlin
Dts x dicoding #1 memulai pemrograman kotlin
 
Dsc how google programs make great developer
Dsc how google programs make great developerDsc how google programs make great developer
Dsc how google programs make great developer
 
First Gathering Sandec
First Gathering SandecFirst Gathering Sandec
First Gathering Sandec
 
Mockup Android Application Template Library
Mockup Android Application Template LibraryMockup Android Application Template Library
Mockup Android Application Template Library
 
Mockup Android Application : Go bon
Mockup Android Application : Go bonMockup Android Application : Go bon
Mockup Android Application : Go bon
 
Lomba Sayembara Logo
Lomba Sayembara LogoLomba Sayembara Logo
Lomba Sayembara Logo
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 

The Best Way to Become an Android Developer Expert with Android Jetpack

  • 1. The Best Way to Become an Android Developer Expert with Android Jetpack Ahmad Arif Faizin Academy Content Writer at Dicoding
  • 2.
  • 3.
  • 4.
  • 6.
  • 7.
  • 8.
  • 9.
  • 22.
  • 23.
  • 24. Jetpack? Kiri, Kanan, L1, L2, R1, R2, Atas, Bawah, Kiri, Kanan
  • 25.
  • 26. Android Jetpack Jetpack is a collection of Android software components to make it easier for you to develop great Android apps.
  • 27. Advantages Accelerate development Eliminate boilerplate code Build high quality, robust apps
  • 28.
  • 29.
  • 30.
  • 32. Constraint Layout VS Other Layout
  • 36. Using Library to Load Image GlidePicasso Pro Tips!
  • 39.
  • 40.
  • 41. Android Networking - get data from API Fast Android Networking Retrofit Volley AQuery
  • 42.
  • 43. Behavior - NotificationsReply & Deep Link action, Bubble, Interruptive & Gentle Notification Status bar and notification drawer Heads-up notification
  • 44. Notification Channel On and above Android 8.0 (Oreo) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { val channel = NotificationChannel( CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT) mBuilder.setChannelId(CHANNEL_ID) mNotificationManager.createNotificationChannel(channel) }
  • 45. Behavior - PermissionsCompatibility APIs for checking and requesting app permissions <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.snazzyapp"> <uses-permission android:name="android.permission.SEND_SMS"/> <application ...> ... </application> </manifest>
  • 46. if (ContextCompat.checkSelfPermission(thisActivity, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) { if (ActivityCompat.shouldShowRequestPermissionRationale(thisActivity, Manifest.permission.READ_CONTACTS)) { } else { ActivityCompat.requestPermissions(thisActivity, new String[]{Manifest.permission.READ_CONTACTS}, MY_PERMISSIONS_REQUEST_READ_CONTACTS); } } else { // Permission has already been granted } Request Permission Flow
  • 47. Permissions.check(this/*context*/, Manifest.permission.CALL_PHONE, null, new PermissionHandler() { @Override public void onGranted() { // do your task. } }); Pro Tips! Permission using Library Android Permissions https://github.com/nabinbhandari/Android-Permissions
  • 48. Behavior - PreferencesCreate interactive settings screens <androidx.preference.PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"> <SwitchPreferenceCompat app:key="notifications" app:title="Enable message notifications"/> <Preference app:key="feedback" app:title="Send feedback" app:summary="Report technical issues or suggest new features"/> </androidx.preference.PreferenceScreen>
  • 50. Foundation - TestingAn Android testing framework for unit and runtime UI tests
  • 51. Foundation - TestingAn Android testing framework for unit and runtime UI tests
  • 52. Foundation - Unit Test Getting Started dependencies { // Required -- JUnit 4 framework testImplementation 'junit:junit:4.12' // Optional -- Robolectric environment testImplementation 'androidx.test:core:1.0.0' // Optional -- Mockito framework testImplementation 'org.mockito:mockito-core:1.10.19' }
  • 53. Foundation - Instrumental Testing Getting Started dependencies { androidTestImplementation 'androidx.test:runner:1.1.0' androidTestImplementation 'androidx.test:rules:1.1.0' // Optional -- Hamcrest library androidTestImplementation 'org.hamcrest:hamcrest-library:1.3' // Optional -- UI testing with Espresso androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' // Optional -- UI testing with UI Automator androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' }
  • 54.
  • 56.
  • 57.
  • 59. Architecture Pattern ● Maintainability ● Testability ● Extensibility
  • 60.
  • 61. Architecture Component Lifecycle - ViewModel - LiveData -Room
  • 63. Architecture - ViewModelManage UI-related data in a lifecycle-conscious way
  • 64. Architecture - LiveData Ensures your UI matches your data state No memory leaks No crashes due to stopped activities No more manual lifecycle handling Always up to date data Proper configuration changes Sharing resources Notify views when underlying database changes
  • 65.
  • 66. Architecture - LiveData public class NameViewModel extends ViewModel { // Create a LiveData with a String private MutableLiveData<String> currentName; public MutableLiveData<String> getCurrentName() { if (currentName == null) { currentName = new MutableLiveData<String>(); } return currentName; } // Rest of the ViewModel... } Notify views when underlying database changes
  • 67. public class NameActivity extends AppCompatActivity { private NameViewModel model; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Other code to setup the activity... // Get the ViewModel. model = ViewModelProviders.of(this).get(NameViewModel.class); // Create the observer which updates the UI. final Observer<String> nameObserver = new Observer<String>() { @Override public void onChanged(@Nullable final String newName) { // Update the UI, in this case, a TextView. nameTextView.setText(newName); } }; // Observe the LiveData, passing in this activity as the LifecycleOwner and the observer. model.getCurrentName().observe(this, nameObserver); } }
  • 68. Architecture - RoomFluent SQLite database access
  • 69. SQLite Vs Room Create database table @Entity public class User { @PrimaryKey public int uid; @ColumnInfo(name = "first_name") public String firstName; @ColumnInfo(name = "last_name") public String lastName; } private static final String WORD_LIST_TABLE_CREATE = "CREATE TABLE " +WORD_LIST_TABLE + " (" + UID + " INTEGER PRIMARY KEY, " + FIRST_NAME + " TEXT, ” + LAST_NAME + " TEXT );";
  • 70. Architecture - RoomEntity @Entity public class User { @PrimaryKey public int uid; @ColumnInfo(name = "first_name") public String firstName; @ColumnInfo(name = "last_name") public String lastName; }
  • 71. Architecture - RoomDao @Dao public interface UserDao { @Query("SELECT * FROM user") List<User> getAll(); @Query("SELECT * FROM user WHERE uid IN (:userIds)") List<User> loadAllByIds(int[] userIds); @Query("SELECT * FROM user WHERE first_name LIKE :first AND " + "last_name LIKE :last LIMIT 1") User findByName(String first, String last); @Insert void insertAll(User... users); @Delete void delete(User user); }
  • 72. Architecture - RoomDatabase @Database(entities = {User.class}, version = 1) public abstract class AppDatabase extends RoomDatabase { public abstract UserDao userDao(); } Create Database AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "database-name").build();
  • 73. Architecture - PagingGradually load information on demand from your data source
  • 74.
  • 75. Architecture - PagingGradually load information on demand from your data source DataSource @Dao public interface ConcertDao { // The Integer type parameter tells Room to use a // PositionalDataSource object. @Query("SELECT * FROM concerts ORDER BY date DESC") DataSource.Factory<Integer, Concert> concertsByDate(); }
  • 76. Architecture - PagingGradually load information on demand from your data source PagedList public class ConcertViewModel extends ViewModel { private ConcertDao concertDao; public final LiveData<PagedList<Concert>> concertList; // Creates a PagedList object with 50 items per page. public ConcertViewModel(ConcertDao concertDao) { this.concertDao = concertDao; concertList = new LivePagedListBuilder<>( concertDao.concertsByDate(), 50).build(); } }
  • 77. Architecture - PagingGradually load information on demand from your data source UI public class BookmarkPagedAdapter extends PagedListAdapter<DataModel, ViewHolder> { ... }
  • 78. Architecture - WorkManagerBest practice to handling background process
  • 79.
  • 80. Architecture - WorkManager public class UploadWorker extends Worker { public UploadWorker(@NonNull Context context, @NonNull WorkerParameters params) { super(context, params); } @Override public Result doWork() { // Do the work here--in this case, upload the images. uploadImages() // Indicate whether the task finished successfully with the Result return Result.success() } } Manage your Android background jobs
  • 81. Architecture - WorkManager OneTimeWorkRequest OneTimeWorkRequest uploadWorkRequest = new OneTimeWorkRequest.Builder(UploadWorker.class).build() PeriodicWorkRequest Constraints constraints = new Constraints.Builder().setRequiresCharging(true).build(); PeriodicWorkRequest saveRequest = new PeriodicWorkRequest.Builder(SaveImageFileWorker.class, 1, TimeUnit.HOURS).setConstraints(constraints).build(); WorkManager.getInstance().enqueue(saveRequest); Manage your Android background jobs
  • 82. Architecture - WorkManagerManage your Android background jobs WorkContinuation chain1 = WorkManager.getInstance() .beginWith(workA) .then(workB); WorkContinuation chain2 = WorkManager.getInstance() .beginWith(workC) .then(workD); WorkContinuation chain3 = WorkContinuation .combine(Arrays.asList(chain1, chain2)) .then(workE); chain3.enqueue();
  • 86.
  • 87. Sertifikat / Sertifikasi Kebutuhan Industri IT Talenta Digital Lulusan universitas Lulusan SMK Otodidak Kursus Profesional dll (re-skilling) Training / Matrikulasi Sertifikasi
  • 88.
  • 89.
  • 91.
  • 92.
  • 93. VS
  • 94. —IMAM SYAFI’I Jika kamu tidak sanggup menahan lelahnya belajar maka kamu harus sanggup menahan perihnya kebodohan
  • 96. 97 Ahmad Arif Faizin 0857 4048 2440 @arif_faizin arif@dicoding.com