문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top