1

i want to send large string to server from android, i can send small string with this methos

        InputStream is;
        String name = "Name";
        String str = "LargeString";

        ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();

        nameValuePairs.add(new BasicNameValuePair("name", name));
        nameValuePairs.add(new BasicNameValuePair("encoded", str));

        try {

            HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new
            HttpPost("http://192.168.1.101/test/insert.php");
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            HttpResponse response = httpclient.execute(httppost);
            HttpEntity entity = response.getEntity();
            is = (InputStream) entity.getContent();


        } catch (Exception e) {

            Log.e("log_tag", "Error in http connection " + e.toString());

        }

With this code i able to send small string but can't large string. Please help me.

Thank You.

1 Answers1

0

Use HttpUrlConnection.

You can take reference from here.

sagarpatidar
  • 1,532
  • 1
  • 16
  • 19