I've poured over similar questions but can't find the answer. I want to be able to long press the user-uploaded images in my webview to save them (like you can in a browser). Any help?
Update:
The context menu is popping up now with my own custom item "Save Image". I can even successfully toast msgs. How do I go about saving the image though? Is the image that's being long clicked being passed to my menu item?
public boolean onLongClick(View v) {
openContextMenu(v);
return true;
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.context, menu);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
switch (item.getItemId()) {
case R.id.save_image:
Toast.makeText(this, "save failed",
Toast.LENGTH_LONG).show();
return true;
default:
return super.onContextItemSelected(item);
}
}