0

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.

BrokenCodez
  • 53
  • 1
  • 8

1 Answers1

0

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.

Community
  • 1
  • 1
jmorris
  • 388
  • 4
  • 6