title: Android studio listview change item
body: <p>can anyone help me with changing the name of the item in listview? I don't have an idea how to do it. I am using SQLite database and this is my update name:</p>
  
  <pre><code>public void doneName(String finishedName,int id, String oldName)
      {
  
          SQLiteDatabase db = this.getWritableDatabase();
          String query = "UPDATE " + TABLE_NAME + " SET " + COL2 + " = '" + finishedName + "' WHERE " + COL1 +
                  " = '" + id + "'" + " AND " + COL2 + " = '" + oldName + "'";
          db.execSQL(query );
      }
  </code></pre>
  
  <p>after that in my activity I have set onItemClickListener where it should change name but it does not, it only shows toast:</p>
  
  <pre><code>            @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                  String name = parent.getItemAtPosition(position).toString();
                  Cursor cursor =th.getItemID(name);
                  int itemID = -1;
                  while(cursor.moveToNext())
                  {
                      itemID = cursor.getInt(0);
                  }
                  if(itemID&gt;-1) {
                      String item = "Done";
                      th.doneName(item, selectedID, selectedName);
                      Toast.makeText(HomePageActivity.this, "You have accomplished this task!", Toast.LENGTH_SHORT).show();
                  }}
          });
  
  </code></pre>