samedi 27 décembre 2014

[Q] Android Studio - Action Bar Error topic

17:44






Hello,

I'm very new to Android development and to this site, so I'm sorry if I'm posting a common issue or in the wrong place.
I am using a tutorial to just develop a simple app to get my feet wet.
I'm at the point where I create an Action Bar, and this is what I have in MainActivity.java :
@override
public boolean onCreateOptionsMenu(Menu menu) {

// Inflate the menu.
// Adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);

// Access the Share Item defined in menu XML
MenuItem shareItem = menu.findItem(R.id.menu_item_share);

// Access the object responsible for
// putting together the sharing submenu
if (shareItem != null) {
mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider();
}

// Create an Intent to share your content
setShareIntent();

return true;
}

For the bold and highlighted part of the code, Android Studio is saying that cannot be applied. This is not allowing me to run the app.

Thanks for any help/advice!






Written by

We are Creative Blogger Theme Wavers which provides user friendly, effective and easy to use themes. Each support has free and providing HD support screen casting.

0 commentaires:

Enregistrer un commentaire

 

© 2013 Mobile Probleme. All rights resevered. Designed by Templateism

Back To Top