By Niga Satrio Kumara

This codelab (practical) follows on from 10.1 Part A: Room, LiveData, and ViewModel. This codelab gives you more practice at using the API provided by the Room library to implement database functionality. You will add the ability to delete specific items from the database. This codelab also includes a coding challenge, in which you update the app so the user can edit existing data.

What you’ll do

  • Update the RoomWordsSample app to keep data when the app closes.
  • Allow users to delete all words by selecting an Options menu item.
  • Allow users to delete a specific word by swiping…

By niga satrio kumara

Image result for view model gif

The Android operating system provides a strong foundation for building apps that run well on a wide range of devices and form factors. However, issues like complex lifecycles and the lack of a recommended app architecture make it challenging to write robust apps. The Android Architecture Components provide libraries for common tasks such as lifecycle management and data persistence to make it easier to implement the recommended architecture.

Task 1: Create the RoomWordsSample app

1.1 Create an app with one Activity

  • Name the app RoomWordsSample.
  • If you see check boxes for Include Kotlin support and Include C++ support, uncheck both boxes.
  • Select only the Phone & Tablet form factor…

By Niga Satrio Kumara

Image result for firebase gif

Firebase is a technology that allows you to make web applications with no server-side programming so that development turns out to be quicker and easier. It supports the web, iOS, OS X, and Android clients.

Get The Sample Code

Clone the GitHub repository from the command line:

$ git clone https://github.com/firebase/friendlychat-android

By Niga Satrio Kumara

Task 1. Add Search

1.1. Add an Options Menu with Search item

Create a menu with one item Search. Reference the code snippet for values.

<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app = "http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.android.example.wordlistsqlsearchable.MainActivity">

<item
android:id="@+id/action_search"
android:title="Search..."
android:orderInCategory="1"
app:showAsAction="never" />
</menu>

By Niga Satrio Kumara

A SQLite database is a good storage solution when you have structured data that you need to store persistently and access, search, and change frequently.

When you use a SQLite database, all interactions with the database are through an instance of the SQLiteOpenHelper class which executes your requests and manages your database for you.

What you will DO

  • Implement a custom class to model your data.
  • Create a subclass of SQLiteOpenHelper that creates and manages your app’s database.
  • Display data from the database in the RecyclerView.
  • Implement functionality to add, modify, and delete data in the UI, and store the…

By Niga Satrio Kumara

Apps often include settings that allow users to modify app features and behaviors. For example, some apps allow the user to set their home location, default units for measurements, and other settings that apply to the entire app. Users don’t access settings frequently, because once a user changes a setting, such as a home location, they rarely need to go back and change it again.

What you’ll do

  • Create an app that includes Settings in the options menu.
  • Add a Settings option toggle switch.
  • Add code to set the default value for the setting, and access the setting value…

By Niga Satrio Kumara

Shared preferences allow you to store small amounts of primitive data as key/value pairs in a file on the device. To get a handle to a preference file, and to read, write, and manage preference data, use the SharedPreferences class. The Android framework manages the shared preferences file itself. The file is accessible to all the components of your app, but it is not accessible to other apps.

What you’ll do

  • Update an app so it can save, retrieve, and reset shared preferences.

📌 Task 1: Explore HelloSharedPrefs

1.1 Open and run the HelloSharedPrefs project

📎 Download the HelloSharedPrefs-Starter code.

📎 Open the project in Android Studio, and build and run…


By Niga Satrio Kumara

RecyclerView is a subclass of ViewGroup and is a more resource-efficient way to display scrollable lists. Instead of creating a View for each item that may or may not be visible on the screen, RecyclerView creates a limited number of list items and reuses them for visible content.

In this practical you do the following:

  • Use RecyclerView to display a scrollable list.
  • Add a click handler to each list item.
  • Add items to the list using a floating action button (FAB), the pink button in the screenshot in the app overview section. …

by Niga satrio kumara

In the early stages of developing an app, you should determine the path you want users to take through your app to do each task. (The tasks are things like placing an order or browsing content.) Each path enables users to navigate across, into, and out of the tasks and pieces of content within the app.

What you’ll do

  • Continue adding features to the Droid Cafe project from the previous practical.
  • Provide the Up button in the app bar to navigate up to the parent Activity.
  • Create a new app with tabs for navigating Activity screens that can also…

By Niga satrio Kumara

Broadcasts are messages that the Android system and Android apps send when events occur that might affect the functionality of other apps or app components. For example, the Android system sends a system broadcast when the device boots up, or when headphones are connected or disconnected. If the wired headset is unplugged, you might like your media app to pause the music.

What you’ll do

  • Subclass a BroadcastReceiver to show a toast when a broadcast is received.
  • Register your receiver to listen for system broadcasts.
  • Send and receive a custom broadcast intent.

Task 1. Set up the PowerReceiver project

  1. In Android Studio, create a new Java…

Niga Kumara

Making History.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store