Android添加书签(二)(4)
来源:未知 责任编辑:责任编辑 发表时间:2013-11-26 22:12 点击:次
* @return true
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
menu.add(0, MENU_ADD, 0, "Add New Bookmark").setIcon(
android.R.drawable.ic_menu_info_details);
menu.add(0, MENU_ABOUT, 1, R.string.menu_about).setIcon(
android.R.drawable.ic_menu_info_details);
return true;
}
/**
* Invoked when the user selects an item from the Menu.
*
* @param item
* the Menu entry which was selected
* @return true if the Menu item was legit (and we consumed it), false
* otherwise
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == MENU_ABOUT) {
showDialog(DIALOG_WELCOME);
return true;
} else if (item.getItemId() == MENU_ADD) {
Browser.saveBookmark(this, "New Bookmark", "http://");
bookmarkAdapter.notifyDataSetChanged();
return true;
} else
return false;
}
public void onItemClick(AdapterView<?> arg0, View view, int position,
long id) {
currentPos = position;
bookmarkAdapter.setSelected(position);
}
public void onClick(View v) {
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>