Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
protected void onCreate(Bundle savedInstanceState) {
        if (android.os.Build.VERSION.SDK_INT > 9) {
            StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
            String IMEI="1234566";
            String Phonemodel="Samsung";
            HttpClient httpClient=new DefaultHttpClient();
//        HttpPost httpPost=new HttpPost("http://localhost:50554/api/vetri?id="+Id+"&Imei="+Imei+"Btrylevel="+Battery);
            HttpPost httpPost1=new HttpPost(""+IMEI+"&Phonemodel="+Phonemodel);
            try {
                HttpResponse response=httpClient.execute(httpPost1);
            } catch (ClientProtocolException e) {
            } catch (IOException e) {
Updated 5-May-15 23:59pm
[no name] 6-May-15 6:00am    
Do u got any error?
Member 11420908 6-May-15 6:07am    
OriginalGriff 6-May-15 6:05am    
How would we know?
We have do idea what you expect it to do!
Member 11420908 6-May-15 6:07am    
i want post values to the url
CHill60 6-May-15 6:08am    
So what happens when you run it???

1 solution


I recommend to check the server status. Your error is empty but there is respone from server. How to get it?

Add this line please:

HttpResponse responseFromServer = httpClient.execute(postMethod);
int status = responseFromServer.getStatusLine().getStatusCode();

Check the status variable.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900