如何在android中解决Java.Io.IoException

I'm trying to call php web service using post method and parameters, but im getting exception at OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); this line, i have noticed by debugging, i have search for this error but not getting any proper solutions, can anyone help me to solve this error? thanks in advance.

String data = URLEncoder.encode("name", "UTF-8")
                + "=" + URLEncoder.encode("wsd", "UTF-8");

        data += "&" + URLEncoder.encode("email", "UTF-8") + "="
                + URLEncoder.encode("asd", "UTF-8");

        data += "&" + URLEncoder.encode("user", "UTF-8")
                + "=" + URLEncoder.encode("asd", "UTF-8");

        data += "&" + URLEncoder.encode("pass", "UTF-8")
                + "=" + URLEncoder.encode("sad", "UTF-8");

        String text = "";
        BufferedReader reader=null;
        try
        {

            // Defined URL  where to send data
            URL url = new URL("http://androidexample.com/media/webservice/httppost.php");

            // Send POST data request

            URLConnection conn = url.openConnection();
            conn.setDoOutput(true);
            OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
            wr.write( data );
            wr.flush();

            // Get the server response

            reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            StringBuilder sb = new StringBuilder();
            String line = null;

            // Read Server Response
            while((line = reader.readLine()) != null)
            {
                // Append server response in string
                sb.append(line + "
");
            }


            text = sb.toString();
        }
        catch(Exception ex)
        {

        }
        finally
        {
            try
            {

                reader.close();
            }

            catch(Exception ex) {}
        }

        // Show response on activity
        //content.setText( text  );

    return text;
    }

On sending parameters, try this:

OutputStream output = new BufferedOutputStream(urlConnection.getOutputStream());
output.write(param.getBytes());
output.flush();
output.close();