List of usage examples for android.widget ImageView setOnCreateContextMenuListener
public void setOnCreateContextMenuListener(OnCreateContextMenuListener l)
From source file:org.mixare.MixListView.java
public static void createContextMenu(ImageView icon) { icon.setOnCreateContextMenuListener(new OnCreateContextMenuListener() { public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { int index = 0; switch (ListItemAdapter.itemPosition) { case 0: menu.setHeaderTitle("Wiki Menu"); menu.add(index, index, index, "We are working on it..."); break; case 1: menu.setHeaderTitle("Twitter Menu"); menu.add(index, index, index, "We are working on it..."); break; case 2: menu.setHeaderTitle("Buzz Menu"); menu.add(index, index, index, "We are working on it..."); break; case 3: menu.setHeaderTitle("OpenStreetMap Menu"); menu.add(index, index, index, "We are working on it..."); break; case 4: AlertDialog.Builder alert = new AlertDialog.Builder(ctx); alert.setTitle("insert your own URL:"); final EditText input = new EditText(ctx); input.setText(customizedURL); alert.setView(input);//from ww w . j a v a 2s . c om alert.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Editable value = input.getText(); customizedURL = "" + value; } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); alert.show(); break; } } }); }