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!
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!
0 commentaires:
Enregistrer un commentaire