Code example for ListFragment

Methods: onCreateContextMenu

0
		NewsList.this.startActivity(myIntent);
	} 
 
	public void onCreateContextMenu(ContextMenu menu, View v,
			ContextMenuInfo menuInfo) {
		super.onCreateContextMenu(menu, v, menuInfo);
		menu.add(0, 1, 0, "Share");
		menu.add(0, 2, 0, "Share (Shortend)");
	} 
 
	public boolean onContextItemSelected(MenuItem item) {
		AdapterContextMenuInfo info = (AdapterContextMenuInfo) item
				.getMenuInfo();
			System.out.println(info.id);
			Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
			shareIntent.setType("text/plain");
			if (item.getItemId() == 1) {
			shareIntent.putExtra(Intent.EXTRA_TEXT, news.get((int) info.id)
					.getLink()); 
			} else { 
Experience pair programming with AI  Get Codota for Java