2

in jsp after insertion i'm sending success or failure to android using the following code

 response.setContentType("text/html");
 ObjectOutputStream oos = new ObjectOutputStream(response.getOutputStream());
 oos.writeObject("success");
 out.print("success");

in android i receive the datas using the following code

HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.mysite.com.au/validation1.jsp");
List<NameValuePair> namevaluepairs = new ArrayList<NameValuePair>(2);
namevaluepairs.add(new BasicNameValuePair("pin",pass));
httppost.setEntity(new UrlEncodedFormEntity(namevaluepairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity rp = response.getEntity();
String origresponseText =  EntityUtils.toString(rp);
String responseText = origresponseText.substring(7, origresponseText.length());
Toast.makeText(getApplicationContext(), "Incoming data-->"+responseText, Toast.LENGTH_SHORT).show();
if(responseText.equals("success")){
// do something
}

IS THERE ANY DRAWBACKS IN RECEIVING DATAS FROM JSP TO ANDROID USING THIS CODE

My application works perfectly in my mobile i.e sony xperia....but the same application is not responding in some other phones not all....can anyone please tell me what's the reason behind that

Abhishek Nandi
  • 4,265
  • 1
  • 30
  • 43

0 Answers0