Enabling batch contextual actions in a ListView without long-click - android

I have a ListView with a MultiChoiceModeListener to delete items. At the moment, the action mode is started when a long-click is performed on a item. This is working fine but, in addition, I want to allow the user enable the action mode when they click on a "Edit" button.
Is there a way to enable this mode without a long-click?

I think this is what you are looking for: http://developer.android.com/guide/topics/ui/menus.html#CABforViews
Basically:
Implement the ActionMode.Callback interface
Call startActionMode() manually on button click
An example CommonsWare project that might help: https://github.com/commonsguy/cw-omnibus/tree/master/ActionMode/Manual

Related

android OnkeyListener with filter stop onItemClicklistener from DPAD

This is my custom-dialog layout.
I want to move the selector of days and load respective items in the grid below it.
I could perform it via filter as said here
But because of the filter I am not being able to perform the action that should be triggered while clicking items in the grid view. It works fine when I click via mouse but not D-Pad.
If I remove the filter in keyevent, it works normally, but problem again in sliding the selector via.
As I am working in STB, I have no option except remote as remote functionality is kept as the basic requirement.
Finally solved it by using the filter in every case of key-event rather than at top.

How to implement edit text which doesn't show copy/paste menu

I'm having trouble with making custom EditText component. I want copy/paste/select all feature to be fully prevented.
Long click case is easy to prevent.
But there are 2 cases I've also seen which opens the menu and I'm having troubles with.
Double tap EditText (can be blocked for example to eat douple tap event)
But this removes the selection mode feature.
Some devices launch the menu when just clicking insert controller.
So I want to have insertion and selection controllers visible and usable, but the HandleView menu to be never shown.
Do I have to copy paste and override TextView class or is there simplier hack solution for this.
Br,
Niko

Using addContextMenuItem in sl4a

How do you use addContextMenuItem in sl4a?
I'm using the experimental full-screen UI to display a list view. I want to:
1) trap a long-press on an item on the list
2) show a "pop-up" menu of options relating to that item.
The listview part works fine.
I know how I can do 2) once I get an event (simply display an alert and add items) but I can't see what user action actually triggers the event you define, or how to control it.
E.g. what will fire the "Play" event defined below, and how do I control what does?
droid.addContextMenuItem("Play", "contextmenu", "test")

Android make a case sensitive menu option

I want is a go from a menu that has a list of objects, if you select an option menu another list should appear.
The examples I found seemed to be for listview or webview.
There another way to make a selection from menu options?
So if I'm understanding your right, you want to launch a Context Menu from an Options Menu. You should not do this. From the android documentation:
A context menu is conceptually similar to the menu displayed when the user performs a "right-click" on a PC. You should use a context menu to provide the user access to actions that pertain to a specific item in the user interface. On Android, a context menu is displayed when the user performs a "long press" (press and hold) on an item.
You'd never do a "long press" on an Options Menu item. People just aren't used to doing that.
Try launching another activity instead or using a dialog.
If you have a fixed list of options in mind you might be looking for submenus, which are explained here: http://developer.android.com/guide/topics/ui/menus.html
If you are looking to dynamically build a list of options with an adapter you might find AlertDialog.Builder useful along with its setAdapter method.

Opening ContextMenu by Clicking a Button in Android

How to open the ContextMenu in Android by Clicking a Button?
A context menu is conceptually similar to the menu displayed when the user performs a "right-click" on a PC. You should use a context menu to provide the user access to actions that pertain to a specific item in the user interface.
On Android, a context menu is displayed when the user performs a "long press" (press and hold) on an item.
Alternatively, if you need a button, you can implement the menu for the view and change the content dynamically.
Your question is bad and you should feel bad, given how readily available (if cryptic) the method behind this process is. This small tutorial helped me greatly.
http://www.mikeplate.com/2010/01/21/show-a-context-menu-for-long-clicks-in-an-android-listview/

Categories

Resources