You just use the Java URL class to make a new object. If it succeeds
you have a valid URL string.

As mentioned there are many other situations where the user would
think that they've entered a valid URL but haven't - and you should
address those if you plan on getting standard users satisfied ;-)

On Mon, Aug 5, 2013 at 10:35 PM, N. Paudyal <[email protected]> wrote:
> Yes, I did think I may need to do something like that... I didnt know if
> there was an easier way of doing it.
>
> What does "You can try-catch and make an URL object from the entered text -
> if it
> succeed you have a valid URL to show." mean?  is this some sort of
> function/method to check if a given string is an URL?  If it is, any
> documentation?
>
> Thank you.
>
>
> On Mon, Aug 5, 2013 at 8:30 PM, Nobu Games <[email protected]> wrote:
>>
>> Make yourself familiar with regular expressions and try to evaluate the
>> input string for matching known URL address patterns. The problem here is,
>> that your pattern matching must not be strict. So you also need to allow
>> input like
>>
>> www.domain.com
>> domain.com
>>
>> without http(s) protocol prefix which will be the most likely user input.
>> Unfortunately that is a malformed URL and you need to auto-complete it so it
>> gets valid:
>>
>> www.domain.com --> http://www.domain.com/
>>
>> Everything that does not match your URL pattern should be treated as
>> search query. You could pass on that query to Google or whatever search
>> engine of your choice.
>>
>>
>>
>> On Monday, August 5, 2013 2:10:07 PM UTC-5, SonyPhoneGuy wrote:
>>>
>>> Hello,
>>>
>>> I would like to make a search interface on android with Eclipse.
>>>
>>> I have managed to add a search box on my form by using the menu xml which
>>> shows on the form action bar.  I also have an webview on my form that is to
>>> load what is entered into the search box.
>>>
>>> I was wondering if there was an easy way to do websearch (if the entered
>>> term is not a webresource) or to display the webpage if the search term is
>>> correct ... rather like how the native browser does it on android.
>>>
>>> Thank you.
>>
>> --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Android Developers" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/android-developers/fBGsVjD2C4k/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
Michael Banzon
http://michaelbanzon.com/

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to