I want to make post to the remote db from my device, but i've got NetworkOnMainThread except, how can I solve this task ? Also I need simple example how to post data to remote db.
ib_wyslij.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                sendAccelerationData(zam);
            }
    });
    private void sendAccelerationData(Zamowienie zam)
    {
        //Add data to be send.
        ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
        nameValuePairs.add(new BasicNameValuePair("Zam_suma", Float.toString(zam.getSuma())));
        this.sendData(nameValuePairs);
    }
private void sendData(ArrayList<NameValuePair> data){
        try
        {
            HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost("www.kupa.pl/1.php");
            httppost.setEntity((HttpEntity) new UrlEncodedFormEntity(data));
            HttpResponse response = httpclient.execute(httppost);
            Log.i("postData", response.getStatusLine().toString());
                //Could do something better with response.
        }
        catch(Exception e)
        {
            Log.e("log_tag", "Error:  "+e.toString());
        }  
    }
 
     
     
    