you are opening a URL, then writing that URL to the stream you open at the URL. that's probably not what you wanted. what's the URL, and what is the "command" you are trying to pass? how does the endpoint accept the command? by reading POST data? through GET parameters?

On 9/25/09 7:31 PM, HTN wrote:
I'm developing a remote app that sends commands via http. Normally I
type in a link in a browser and the command will work. With Android, I
would like it to work with a press of a button. I tried the following
code and it didn’t work:

           URL url = "" URL(urlString);

            URLConnection connection = url.openConnection();
            connection.setDoOutput(true);

            OutputStreamWriter out = new OutputStreamWriter
(connection.getOutputStream());
		out.write(urlString);
		out.close();

"urlstring" is the http command link.

Any ideas? Am I on the wrong track? I'm confused because technically I
don't need to write anything to the link. I would think it would work
if I just open the connection.

Thanks.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

  

--

Reply via email to