title: deleting a row in parse server?
body: <p>the problem is the list item on which it is clicked does not get deleted but an item behind or in front of it gets deleted (for list2.get(d) or list2.get(d-1))how to get the item which is clicked to get deleted?)</p>
  
  <pre><code> Intent intent=getIntent();
      k=intent.getStringExtra("this is a");
      list=(ListView)findViewById(R.id.listview);
      list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {
              d=i;
              AlertDialog.Builder dialog=new AlertDialog.Builder(Main3Activity.this);
              dialog.setMessage("this is a");
              dialog.setPositiveButton("yes", new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialogInterface, int l){
                      ParseQuery&lt;ParseObject&gt; b=new ParseQuery&lt;ParseObject&gt;("message");
                      b.findInBackground(new FindCallback&lt;ParseObject&gt;() {
                          @Override
                          public void done(List&lt;ParseObject&gt; objects, ParseException e)
                          {
                              if(e==null) {
                                  for (ParseObject n : objects) {
                                      if (n.getString("message").equals(list2.get(d))&amp;&amp;(n.getString("receiver").equals(ParseUser.getCurrentUser().getUsername().toString())&amp;&amp;n.getString("sender").equals(k)))
                                      {
                                          try {
                                              Toast.makeText(Main3Activity.this,list2.get(d+1), Toast.LENGTH_SHORT).show();
                                              n.delete();
                                          } catch (Exception e1) {
                                              e1.printStackTrace();
                                          }
                                      }
                                  }
                              }
                              else
                              {
                                  Log.i("this is a",e.getMessage());
                              }
                          }
                      });
                      list2.remove(d);
                      a.notifyDataSetChanged();
  </code></pre>