Android call search function programmatically - android

In Google Maps, when you click the search box the real search comes up. The search box is just an imageview illusion with an onclicklistener
similarly, if you press the search button on the mobile device, the search box comes up.
I need to implement similar behavior, when the user clicks an image that is over the map (in a relativelayout), the search box for that mapview comes up.
how would I call the mapview's search feature??? I was thinking of just simulating a search button press but I dont even know what this function's name is.
Thanks for the insight!

The function you are looking for is onSearchRequested(). Just make a call on your onClickListener. Complete guide to search implementation can be found here.
http://developer.android.com/guide/topics/search/index.html

Related

Secret Dialog box

I'm working on an android app , we need a custom dialog box to input some settings once in a while . This custom dialog box need to be hard to find so only some users can find it , like a onLongClick somewhere .
Any Ideas ?
Just think out of the box, what android users are not familiar of something that is not user friendly, the LongClick action every android users do long clicks so do something like a swipe up or down on a button or image be creative :)

Scroll content to bottom of page when EditText box is clicked

I am trying to have the app scrolled all the way to the bottom so that when the user clicks the username EditText box and/or password, he/she will be able to see the Log In button.
Here's what I mean by using an example from the Facebook App.
And this is what my App is doing. Not what I want.
Obviously, I did some research before submitting a question.
I've tried using setSoftInputMode to SOFT_INPUT_ADJUST_PAN and along with other ADJUST options. I also tried to do it the xml but still no luck.
I also tried using scrollView.scrollTo method, and set to button.getBottom() so it will scroll to the end of the button. But again, it didn't work.
Does anyone have any idea of what I could be doing right?
Thanks.

Making Edittext an address and search bar in one Android Eclipse

I am trying to make an edittext into both a search bar and address bar. Also I am not sure how to allow the user hit enter on their keyboard to initiate the search instead of manually touching the go button.
It sounds like you want to use IME actions for your case to allow the user to have a sort of "Go" button which is activated by the enter key. This page on the official Android guide should help you: http://developer.android.com/guide/topics/ui/controls/text.html#Actions
To detect a URL, use the built in Java class to do it. See here: How to detect the presence of URL in a string
Using those two methods, simply check if the entered text is a URL. If it is, then use it, otherwise you call your search method passing in the entered text.

Android: Button representing "get my position!"

I have a EditBox, and on right side of this EditBox I wan't to put a Button representing "Get My Position".
User clicks on this button, and my application get his position and fills EditBox with it.
I found a Compass and added on a ImageButton, but I don't know if this really represent the idea.
Anyone knows a better button to represent "Get My Position"?
Thanks
Your Button looks ok, and will be recognized by most users. If you want to get the System-default (the picture of the Drawalbe may differ on roms from HTC, Samsung Motorola etc) you can get it with
getResources.getDrawable(android.R.drawable.ic_menu_location)
Always check for non-Null here. You can download the standart Android location Button here, (ic_menu_location), as a fallback, if the getDrawable() call fails
I used a 'globe' in my application. If the EditBox is blank until the user requests their location, why not use the put some default text inside it requesting the user to click the button?

Setting the Return key on the Android keyboard

Does anyone of you friendly coders know how to change the text on the return key of the android keyboard. I am catching the return event of an EditText element to start an action. So I would like to show the user, that he can start the action with that key. Some applications do that. E.g. they replace the key with a search symbol.
I am also wondering why apps always have an additional button aside the text field. Clearly, this takes away screen space. But it may be necessary for some purpose I am not aware off. The one problem I could imagine is task switching. After switching back, the user would have to call the keyboard before he could start the action. The other is a hardware keyboard, but anyone will assume that the return key will start the action.
R.G.
There are some ways to change the behaviour of the return button on your software keyboard. If you want to have the search Icon on your keyboard you have to add android:imeOptions="actionSearch" to your EditText View. There are some other actions that you can set for an overview over the available options have a look at the documentation of the TextView.
I would guess the reason that there are buttons next to many textfields to trigger the action is because users are used to it and would be a little bit at loss if the button is missing especially users with a hardware keyboard or if the software keyboard disappeared. One additional problem is that the return key is also used to create line breaks this means that if you want to have a multi line text field you cant use the return key to start an action.
If you want, you can hide the additional button beside the text area by adding the attribute
android:imeOptions="flagNoAccessoryAction" to your TextView or add it in code using
myTextView.setImeOptions(EditorInfo.IME_MASK_ACTION & EditorInfo.IME_FLAG_NO_ACCESSORY_ACTION);.
This is generally advised against, however, because of the user not being able to see what action will be performed when, say, the return key is pressed, or not being able to perform an action at all.
More info in this blog post: http://android-developers.blogspot.dk/2009/04/updating-applications-for-on-screen.html.

Categories

Resources