Showing posts with label url. Show all posts
Showing posts with label url. Show all posts

Android - How to open a URL in Android's web browser from application

How to open an URL from code in the built-in web browser rather than within my application ?

I tried this :
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(strURL));

startActivity(myIntent);

but I got an Exception : "No activity found to handle Intent{action=android.intent.action.VIEW data =www.google.com"

Android - How to make http request using cookies

I'd like to make an http request to a remote server while properly handling cookies (eg. storing cookies sent by the server, and sending those cookies when I make subsequent requests). It'd be nice to preserve any and all cookies, but really the only one I care about is the session cookie.

With java.net, it appears that the preferred way to do this is using java.net.CookieHandler (abstract base class) and java.net.CookieManager (concrete implementation). Android has java.net.CookieHandler, but it does not seem to have java.net.CookieManager.

I could code it all by hand by inspecting http headers, but it seems like there must be an easier way.

What is the proper way to make http requests on Android while preserving cookies?

Popular Posts