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

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.
     */
    intent.setData(geoLocation);
    if (intent.resolveActivity(getPackageManager()) != null) {
        startActivity(intent);
    }
}

Ref here

 

Create Menu on Action Bar

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

Capture

2. In the resource drop list, select menu

Capture2

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

4. Fill Menu with items

<item
    android:id="@+id/action_search"
    android:orderInCategory="1"
    app:showAsAction="ifRoom"
    android:title="@string/search"/>

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:

toast

Working with strings.xml

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

String myString = getString(R.string.today);

 

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