Actually I am showing popup window(custom layout) when options menu item clicked and my options menu are bottom to the screen(splitActionBarWhenNarrow).I am getting some exception please help me code:
switch (item.getItemId()) {
case R.id.redid:
Toast.makeText(MainActivity.this,"red color", Toast.LENGTH_SHORT).show();
break;
case R.id.blueid:
Toast.makeText(MainActivity.this,"blue color", Toast.LENGTH_SHORT).show();
break;
case R.id.greenid:
LayoutInflater inflater=(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View popupview=inflater.inflate(R.layout.popuplayout,null);
PopupWindow popwindow=new PopupWindow(popupview,LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
popwindow.showAsDropDown(item.getActionView(), 100, 100);
Try in this manner:
and outside onCreate() paste this:
I think in this manner may be your problem will be solved.