android-contextmenu

How to show a customized Popup window near the touch location, like what we have when we use ContextMenu?

此生再无相见时 提交于 2019-11-30 09:40:17
问题 Background Seeing that it's not officially possible to have a context menu which has a customized view or even icons for its rows (here), I decided to create my own solution (of custom view that acts like it). The problem When using a context menu on a RecyclerView, the touch position matters, so if you long touch an item, the context menu will try to appear near the touch location (sample taken from here), and without me giving this information (meaning via OnClickListener or

Android opening context menu after button click

江枫思渺然 提交于 2019-11-30 06:11:26
I want to open context menu when I click a button, but also I have to know which list item is focused when I click the button. Do you know how to do that? What code should be in onclick method? dikirill I was looking for the same, and found that instead of context menu, you should use Dialogs final CharSequence[] items = {"Red", "Green", "Blue"}; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Pick a color"); builder.setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { Toast.makeText(getApplicationContext

Android opening context menu after button click

拟墨画扇 提交于 2019-11-29 06:06:28
问题 I want to open context menu when I click a button, but also I have to know which list item is focused when I click the button. Do you know how to do that? What code should be in onclick method? 回答1: I was looking for the same, and found that instead of context menu, you should use Dialogs final CharSequence[] items = {"Red", "Green", "Blue"}; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Pick a color"); builder.setItems(items, new DialogInterface

How can I tell if the input method picker is open or closed?

落爺英雄遲暮 提交于 2019-11-28 03:03:22
问题 My app opens the input method picker (the menu where you choose a keyboard) with InputMethodManager.showInputMethodPicker() . My app doesn't actually create the picker (it's created by InputMethodManager) but I know it's a ContextMenu and its id is R.id.switchInputMethod . The picker is part of a multi-step wizard so I need to know when the picker closes so my app can proceed to the next step. Right now I'm checking in a background thread if the default keyboard changed, but that doesn't help