rosesr
rosesr

Reputation: 789

How to open a link in android?

Hi im writing this application where i need to open a URL. How can it be done in android? is something like opening a HttPClient or something??

Upvotes: 1

Views: 233

Answers (2)

Anurag Ramdasan
Anurag Ramdasan

Reputation: 4340

okay so basically i m assuming that u send some parameters to a particular URL where they are processed and result is sent back. in that case the best way is to use DefaultHttpClient to post data to URL in json format. this example here is something you should look at.

Upvotes: 2

A example about open a url from link textview

private void setAsLink(TextView view, String url){
    Pattern pattern = Pattern.compile(url);
    Linkify.addLinks(view, pattern, "http://");
    view.setText(Html.fromHtml("<a href='http://"+url+"'>http://"+url+"</a>"));
}

Upvotes: 0

Related Questions