I'm implementing an app that uses "Side menu" like the FB Application.
The "Navigation Drawer" is customized for Applications that runs APIs > 11, and my app is intended to be used by any device, even if API < 11, So, I'm using the ActionBarSherloc
, and replaced the normal Menu
, MenuItem
, and MenuInflater
with Sherloc equivalents, and extended SherlocFragmentActivity
.
But for now, i still got an Error inside the "" method :
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// The action bar home/up action should open or close the drawer.
// ActionBarDrawerToggle will take care of this.
if (mDrawerToggle.onOptionsItemSelected((android.view.MenuItem) item)) {
return true;
}
// Handle action buttons
switch (item.getItemId()) {
case R.id.action_websearch:
// create intent to perform web search for this planet
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
intent.putExtra(SearchManager.QUERY, getSupportActionBar()
.getTitle());
// catch event that there's no activity to handle intent
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
} else {
Toast.makeText(this, R.string.app_not_available,
Toast.LENGTH_LONG).show();
}
return true;
default:
return super.onOptionsItemSelected(item);
}
}
In the "if-Statment"...
if (mDrawerToggle.onOptionsItemSelected((android.view.MenuItem) item)) {
return true;
}
if i used "(android.view.MenuItem) item)"...the method throws an exception for the type, and if i replaced it with "com.actionbarsherlock.view.MenuItem"...the method still got an Error of "The method onOptionsItemSelected(MenuItem) in the type ActionBarDrawerToggle is not applicable for the arguments (MenuItem)".
Any help..?! Thanks in advance,