@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.upload: Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(intent, REQUEST_CODE_SELECT_PIC); break; case R.id.emotion: FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); Fragment prev = getSupportFragmentManager().findFragmentByTag(EMOTION_CATEGORY_TAG); if (prev != null) { ft.remove(prev); } DialogFragment newFragment = new EmotionCategorySelectFragment(); newFragment.show(ft, EMOTION_CATEGORY_TAG); break; case R.id.supertext: FunctionUtil.handleSupertext(bodyText, this, v); break; case R.id.send: if (StringUtil.isEmpty(toText.getText().toString())) { if (toast != null) { toast.setText("请输入收件人"); toast.setDuration(Toast.LENGTH_SHORT); toast.show(); } else { toast = Toast.makeText(MessagePostActivity.this, "请输入收件人", Toast.LENGTH_SHORT); toast.show(); } } else if (StringUtil.isEmpty(titleText.getText().toString())) { if (toast != null) { toast.setText("请输入标题"); toast.setDuration(Toast.LENGTH_SHORT); toast.show(); } else { toast = Toast.makeText(MessagePostActivity.this, "请输入标题", Toast.LENGTH_SHORT); toast.show(); } } else if (StringUtil.isEmpty(bodyText.getText().toString())) { if (toast != null) { toast.setText("请输入内容"); toast.setDuration(Toast.LENGTH_SHORT); toast.show(); } else { toast = Toast.makeText(MessagePostActivity.this, "请输入内容", Toast.LENGTH_SHORT); toast.show(); } } else { if (commitListener == null) { commitListener = new ButtonCommitListener(REPLY_URL); } commitListener.onClick(null); } break; default: finish(); } return true; } // OK