Below is my code and I'm trying to send string commands to a non-Android device when I enter a command in an editable text and click a button, its not working! what am I doing wrong?
button.setOnClickListener(new Button.OnClickListener() { //click button(of course) public void onClick(View v) { viewtext.setText(edittext2.getText()); //convert editable text to text view cmd = viewtext.toString(); //convert text view to string mbuttonclicks.start(); //some silly sound effect try { URL newUrl = new URL("http://192.168.1.8"); //start new local url connection URLConnection conn = newUrl.openConnection(); //open it OutputStream outputStream = null; // start output stream to send msg to url try { if(cmd != null){ //if there's a command then do the following outputStream = conn.getOutputStream(); BufferedOutputStream stream = new BufferedOutputStream(outputStream); //use buffered output stream.write(cmd.getBytes()); //convert to bytes and send stream.flush(); //clean up leftover characters }}//command sent catch (IOException ex) { } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en