title: save data from listview to database
body: <p>I have data from listview, and I want to save it in my database, here's my code;</p>
  
  <pre><code>listResep = (ListView) findViewById(R.id.listResep);
  int leng = listResep.getCount();
  for(int i = 0; i &lt; leng; i++) {
      resep = listResep.getItemAtPosition(i).toString();
      new inputResep().execute();
  }
  </code></pre>
  
  <p>and for inputResep;</p>
  
  <pre><code>class inputResep extends AsyncTask&lt;String, String, String&gt; {
  
      /**
       * Before starting background thread Show Progress Dialog
       * */
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
          pDialog = new ProgressDialog(InputRM.this);
          pDialog.setMessage("save Resep..");
          pDialog.setIndeterminate(false);
          pDialog.setCancelable(true);
          pDialog.show();
      }
      /**
       * Creating product
       * */
      protected String doInBackground(String... args) {
          // Building Parameters
          List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
          params.add(new BasicNameValuePair("rm", rm));
          params.add(new BasicNameValuePair("noregis", noregis));
          params.add(new BasicNameValuePair("tanggal", tglinput));
          params.add(new BasicNameValuePair("pukul", pukul));
          params.add(new BasicNameValuePair("ruper", ruper));
          params.add(new BasicNameValuePair("kelas", kelas));
          params.add(new BasicNameValuePair("profesi", profesi));
          params.add(new BasicNameValuePair("kajian", resep));
          params.add(new BasicNameValuePair("id_user", id_user));
          params.add(new BasicNameValuePair("tglsave", tglsave));
          // getting JSON Object
          // Note that create product url accepts POST method
          json = jsonParser.makeHttpRequest(URL_INPUT_RESEP,"POST", params);
  
          // check log cat for response
          Log.d("Create Response", json.toString());
          // check for success tag
          try {
              int success = json.getInt(TAG_SUCCESS);
              Log.d("stat", success+"");
              if (success &gt; 0) {
                  // successfully created product
  
              } else {
                  // failed to create product
              }
          } catch (JSONException e) {
              e.printStackTrace();
              Log.d("test", "JSONException"+e.getMessage());
          }
          return null;
      }
      /**
       * After completing background task Dismiss the progress dialog
       * **/
      protected void onPostExecute(String file_url) {
          pDialog.dismiss();
      }
  }
  </code></pre>
  
  <p>but every time I tried to input resep, it only save last data from listview as much as data in listview, ex= <code>listview: data1, data2, data3; save: data3, data3, data3;</code></p>