Building the application

It is easier to create the UI using design editor inside Android Studio. If you are comfortable with XML-based text editor, you can use that as well. We will create a simple ViewPager (activity_swap.xml) that will hold two input images inside a CoordinatorLayout as shown in the following code block:

<android.support.v4.view.ViewPager    android:id="@+id/container"    android:layout_width="0dp"    android:layout_height="0dp"    android:layout_gravity="center_vertical"    app:layout_behavior="@string/appbar_scrolling_view_behavior"    app:layout_constraintBottom_toTopOf="@+id/container1"    app:layout_constraintHorizontal_bias="0.0"    app:layout_constraintLeft_toLeftOf="parent"    app:layout_constraintRight_toRightOf="parent"    app:layout_constraintTop_toBottomOf= ...

Get Machine Learning Projects for Mobile Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.