Created
June 27, 2012 19:47
-
-
Save Richie97/3006339 to your computer and use it in GitHub Desktop.
Custom View onClick
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean onCreateOptionsMenu(Menu menu) { | |
MenuInflater inflater = getSupportMenuInflater(); | |
inflater.inflate(R.menu.entry_menu, menu); | |
MenuItem mItem = menu.findItem(R.id.menu_comments); | |
commentCount = (TextView)mItem.getActionView().findViewById(R.id.actionEntryCommentCount); | |
commentCount.setText(Integer.toString(article.numComments)); | |
mItem.getActionView().setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
Intent intent = new Intent(EntryActivity.this, CommentsActivity.class); | |
if (type == 1){ | |
intent.putExtra("entryId", entryFrag.article.id); | |
}else{ | |
intent.putExtra("entryId", article.id); | |
} | |
intent.putExtra("type", type); | |
startActivity(intent); | |
} | |
}); | |
return true; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment