Whats the use of app namespace in android xml

Viewed 7884

Below is the code of a menu being displayed in an activity(DetailFragment.xml of Sunshine udacity android course)

I could not understand why two different namespaces are needed below. Why cant I use the namespace android: instead of app:

In below xml part when I replace app:actionProviderClass="android.support.v7.widget.ShareActionProvider" with app:actionProviderClass="android.widget.ShareActionProvider"

It seemed to give some assignment error, but works fine if app is changed to android as below android:actionProviderClass="android.widget.ShareActionProvider"

I am not able to understand what exactly is happening here.

    <menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <item android:id="@+id/action_share"
        android:title="@string/action_share"
        app:showAsAction="always"
        app:actionProviderClass="android.support.v7.widget.ShareActionProvider" />
</menu>
3 Answers
Related