Ferencz András

Ferencz András

  • NA
  • 6
  • 2.8k

Map Activity

Oct 30 2014 2:14 PM
Hy Guys!


I want to make an app with a map view in it, and i want to ad 2 buttons to the action bar!
So i tried everything from the developer pages guied and nothing works...



without any affect.. 

 public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater menuInflater = getMenuInflater();
        menuInflater.inflate(R.menu.main, menu);

        // Calling super after populating the menu is necessary here to ensure that the
        // action bar helpers have a chance to handle this event.
        return super.onCreateOptionsMenu(menu);
    }

xml : 
<?xml version="1.0" encoding="utf-8"?>

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:yourapp="http://schemas.android.com/apk/res-auto" >
        <item android:id="@+id/action_search"
        android:icon="@drawable/ic_action_search"
        android:title="Search"
            yourapp:actionProviderClass="android.support.v7.widget.ShareActionProvider"
            yourapp:showAsAction="always"/>
        <item android:id="@+id/action_compose"
        android:icon="@drawable/ic_action_refresh"
        android:title="Try Once again"
            yourapp:actionProviderClass="android.support.v7.widget.ShareActionProvider"
            yourapp:showAsAction="ifRoom"/>

</menu>

i want this 2 buttons to be in tha action bar at the rigth side.. 
Somebody please help me :)
Thanks a lot !


Answers (2)