title: Dealing with update from database using a list
body: <p>I have a problem in dealing with update from database using a list, in edit class I have this method</p>
  
  <pre><code>private ArrayList&lt;store&gt; store_List = new ArrayList&lt;store&gt;();
  list = (ListView) findViewById(R.id.list);
  list.setOnItemClickListener(new OnItemClickListener() {
  
      @Override
      public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
          store store = store_List.get(position);
          Intent intent = new Intent(edit.this,Update.class);
          edit.this.finish();
          startActivity(intent);
      }
  });
  </code></pre>
  
  <p>In Update class, I have this method:</p>
  
  <pre><code>  btnUpdate.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
              DB db = new DB(getApplicationContext());
              try {
                      db.open();
                      db.updatestore(HERE WHAT SHOULD I PASS);
                      adapter.notifyDataSetChanged();
                  } catch (SQLiteException se) {
                      Log.e(getClass().getSimpleName(),
                              "Could not create or Open the database");
                  } finally {
                      if (db != null)
                          db.close();
  
                  }
          }
      });
  </code></pre>
  
  <p>In DB, the method update is as follow:</p>
  
  <pre><code>   public int updatestore(store s) {
      SQLiteDatabase db = this.getWritableDatabase();
      ContentValues values = new ContentValues();
      values.put(KEY_NAME, s.getName());
      values.put(KEY_CATEGORY, s.getCategory());
      return db.update(TABLE_store, values, KEY_ID + " = ?",
              new String[] { String.valueOf(s.getEid()) });
     }
  </code></pre>