0

I have this code

private class PostContacts extends AsyncTask<Void, Void, Void> {

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        pDialog = new ProgressDialog(TableMenuActivity.this);
        pDialog.setMessage("Odesílám objednávku...");
        pDialog.setCancelable(false);
        pDialog.show();
    }

    @Override
    protected Void doInBackground(Void... arg0) {
        try {
            JSONArray polozky = new JSONArray();

            try {
                JSONArray polozky = new JSONArray();

                for (int i = 0; i < rekapitulaceArray.size(); i++) {
                    JSONObject polozka = new JSONObject();
                    polozka.put("name", "jmeno");
                    polozka.put("name", rekapitulaceArray.get(i));
                    polozky.put(polozka);
                }
            }

This will generate an array from ListView, depending on items selected. I want to send them to server. I have tried everything and this is the last thing I need for a school assignment, but I'm unable to get it to work.

If you could write me a code with a simple explanation and also a script to server which will accept the data, I would appreciate it.

Chris Forrence
  • 10,042
  • 11
  • 48
  • 64
user3185930
  • 29
  • 1
  • 1
  • 11
  • possible duplicate of [Transfer JSON to server in post request](http://stackoverflow.com/questions/16112277/transfer-json-to-server-in-post-request) – nikis Feb 12 '14 at 13:39
  • I understand that what you want to do is send a JsonArray to a server. For that http://stackoverflow.com/questions/3027066/how-to-send-a-json-object-over-request-with-android – EdmDroid Feb 12 '14 at 13:45
  • yes, thats what i need, but i need code for newbie, maybe this is it, but what's the server side code? – user3185930 Feb 12 '14 at 13:53
  • Ok for that u will have to tag this question with a server tag too.......I don't have expertise in server side programming! – EdmDroid Feb 12 '14 at 13:54

0 Answers0