Android: Handle click link event in edittext - android

I have an EditText where I wanted to make link (email, web, phone) clickable. I was able to do it by using
mBodyText.setMovementMethod(LinkMovementMethod.getInstance());
it works perfectly and all links open when clicking on them.
Here comes my requirement. I want to open contextual action bar (like default copy/ paste one) when user click on a link in edit text.
I know how to start a contextual action bar. But I don't know how can I catch the event when user clicks the link and to identify what kind of link it is (phone or web etc...) to show the proper menus in CAB.
After searching for hours, I come here to get the suggestion.

Related

Menu search bar pushes other menu buttons when clicked

My problem is in the photos.
When I click on search, the search section opens and pushes the side menu buttons out. Buttons are not visible. I want them to appear even if search is open. However, I couldn't find how to do this. Thank you.

Intents for EditText LongPress

i want my application to be seen when a user long presses on edit text to copy or paste.
or clicks on copy or paste.
i tried with different intents like
ACTION_PASTE ,
ACTION_EDIT
But none are working for me !!
Please help me out
Thanks in advance.
There is no way for you to automatically appear in the action mode or context menu that appears when the user selects text in an EditText for other applications.
For your own EditText widgets, you can use setCustomSelectionActionModeCallback() to add items to the standard action mode on API Level 11+.

How to Intercept the keyguard(software menu) clicks for eg "Settings" menu option click?

Is there a way to find out when did a user click "Setting" options on the screen menu?
The onClick listner's KeyDown events catches only the hardware buttons on the phone and not the clicks of the sofware keyboard that shows up when a textbox/editText gets a focus and the key guard shows up.
Is it even possible using public android SDK.
P.S. : I am only concerned with 2.2 and 2.3 so its fine if this is not possible on 3.0 and above.
Thnx
EDIT
Explanation of a scenario that will help understand the question better!
I have a full screen activity with a editText and a button. I want to intercept all the clicks that a user make and based on that make some decisions.
I am able to register a listner to intercept what phisical keys are being clicked(HOME, MENU, VOLUME UP/DOWN etc)...The problem is, when the user clicks on the editText i.e. the text box gets the focus, the sotware keypad shows up. Now I also want to intercept what keys(numbers, alphabets, special characters or even custom functions on some samsung android phone like 'Go To Settings' are clicked and perform action based on the clicks.
My question is, is it possible and if yes, then how?
NOTE: Please dont ask me why am I doing this because its bad user experience. I am very much aware of that. I am trying to do this in a particular context that needs this functionality. Thnx!
You need to use the KeyListener class and setKeyListener
http://developer.android.com/reference/android/widget/TextView.html
This only allows you to modify/filter input into the TextView.

How to get text selected before user clicks on Copy

I have a WebView and I want user to be able to select text and then display a QuickAction so that they can choose the action he will perform on that text he just selected.
The problem I have is that I can't find a way to get text selected before the user clicks on Copy on the Action Bar.
I want to popup the QuickAction as soon as TouchUp event is fired and I don't want to have them to select Copy on the Action Bar before that.
Any idea on how to implement this behaviour?
I'm developping on Android 3.1 SDK and using android.content.ClipboardManager.

How to activate option menu when search box is displayed? (SearchManager)

I am trying to build a quick search box. it is basically a widget. Upon clicking, it pops up the quick search box and launch the browser with query string. No activity except searchactivity.
And also added codes for 'recent query suggestion' But having a problem to have menu for 'clear history' Here is what I wanted to implement. When quick search box is displayed, by pressing menu button, I want option menu to be popped up, keypad to be disappeared, quick search box to be stayed.
the implementation of google sample code - Searchable dictionary is not what I want to implement. It starts an activity with instruction message and when a user presses the search button or menu button, it pops up the quick search box. Mine is when it runs from a widget, the quick search box is popped up right away just like the google search widget.
How can I override onCreateOptionMenu on searchmanager? Or is there any way to activate option menu when the searchmanager is activated?
Please take a look at the images below. the second image is what I want to implement upon clicking menu button.
What you need to do is make the search button launch the default search activity when it is pressed. And make it sorta match the existing search dialog style. You can notice this is how the official Twitter client works. You can use apktool (google it) to take a look at the official Twitter clients resource files to get a better idea of how this can be accomplished.

Categories

Resources