This post is still a work-in-progress.

Table Of Contents

  • Google Maps
  • Common Intent
  • Create Menu on Action Bar
  • Working with strings.xml
  • Create Scroll List
  • Create a URI
  • UI
  • Data Binding


  • FrameLayout: Used to display only one item
  • RelativeLayout: Enables you to decide the relation between the different views. i.e, The textbox should be left to the ImageView…
  • ConstraintLayout: uses constraints to place views – efficient instead of using recursive layouts. notice the layout_constraintLeft_...


Data Binding

Enable Data Binding in your application

in the module build.gradle file, under the Android tag, enable the binding as follows:

android {
    dataBinding.enabled = true;

Use <layout> as the root element of the layout activity

in our example, it is main_activity.xml. Don’t forget to move the xmlns attributes to the root element:

<layout xmlns:app=""

Create a data binding instance called mBinding of type ActivityMainBinding at​​​ (this could be any java file)

ActivityMainBinding mBinding;

Set the Content View using DataBindingUtil to the activity_main layout

DataBindUtil.setContentView replaces our normal call of setContent view.
DataBindingUtil also created our ActivityMainBinding that we will eventually use to
display all of our data.

 mBinding = DataBindingUtil.setContentView(this, R.layout.activity_main);

Load a BoardingPassInfo object with fake data using FakeDataUtils

BoardingPassInfo fakeBoardingInfo = FakeDataUtils.generateFakeBoardingPassInfo();

Call displayBoardingPassInfo and pass the fake BoardingInfo instance

    private void displayBoardingPassInfo(BoardingPassInfo info) {

        // COMPLETED (6) Use mBinding to set the Text in all the textViews using the data in info

Activity LifeCycle


Google Maps

Ref here

Common Intents

Common intent is used to share data with other apps via a url.

private void showMap(Uri geoLocation) {
     * Again, we create an Intent with the action, ACTION_VIEW because we want to VIEW the
     * contents of this Uri.
    Intent intent = new Intent(Intent.ACTION_VIEW);

     * Using setData to set the Uri of this Intent has the exact same affect as passing it in
     * the Intent's constructor. This is simply an alternate way of doing this.
    if (intent.resolveActivity(getPackageManager()) != null) {

Ref here


Create Menu on Action Bar

1. Right click the resource directory(res) -> New -> Android Resource Directory


2. In the resource drop list, select menu


3. Right-click the generated menu folder under res, and then New->Menu Resource File

4. Fill Menu with items


5. Override menu methods: In the activity java file, override the next methods:

6. Toast: On line 7, use the toast to get the next feature:


Working with strings.xml

you can get a String saved in res -> values -> strings.xml by calling the getString method.

String myString = getString(;


Create Scroll List

add the next to the activity layout xml:

then fill the list as follows:

Create a URI

To create a well-formed Uri without having to worry about the particular uri components, use the Uri Builder