title: How to update data in TextBox on the button click event in Android?
body: <p>i Create an Android Application,in that Application i insert and delete Normally But i cannot Update it.Am trying to update but i got a error.</p>
  
  <pre><code>public Helper(Context ctx) 
  {
      this.context = ctx;
      DBHelper = new DatabaseHelper(context);
  }
  
  private static class DatabaseHelper extends SQLiteOpenHelper 
  {
      DatabaseHelper(Context context) 
      {
          super(context, DATABASE_NAME, null, DATABASE_VERSION);
      }
  
      @Override
      public void onCreate(SQLiteDatabase db) 
      {
          db.execSQL(DATABASE_CREATE);
      }
  
      @Override
      public void onUpgrade(SQLiteDatabase db, int oldVersion, 
      int newVersion) 
      {
          Log.w(TAG, "Upgrading database from version " + oldVersion 
                  + " to "
                  + newVersion + ", which will destroy all old data");
          db.execSQL("DROP TABLE IF EXISTS titles");
          onCreate(db);
      }
  }    
  
  //---opens the database---
  public Helper open() throws SQLException 
  {
      db = DBHelper.getWritableDatabase();
      return this;
  }
  
  //---closes the database---    
  public void close() 
  {
      DBHelper.close();
  }
  
  //---insert a title into the database---
  public long insert(String name) 
  {
       ContentValues initialValues = new ContentValues();
       initialValues.put("Name", name);
      return db.insert(DATABASE_TABLE, null,initialValues);
  }
  //---updates a title---
  public long update(String name)
          {
              ContentValues args = new ContentValues();
              args.put("Name",name);
  
              return db.update(DATABASE_TABLE, args, 
                               "Name" + "=" + name, null);
          }
  
  
  //---deletes a particular title---
  public int delete(String name) 
  {
     // return db.delete(DATABASE_TABLE,"Name="+name, null);
      return db.delete(DATABASE_TABLE,"Name=?",new String[]{String.valueOf(name)});
  }
  </code></pre>
  
  <p>}</p>
  
  <p>My Activity File</p>
  
  <pre><code>    private static final String DATABASE_CREATE =
      "create table titles (_id integer primary key autoincrement, "
       + "Name text not null);";
  
  private final Context context; 
  
  private DatabaseHelper DBHelper;
  private SQLiteDatabase db;
  
  public Helper(Context ctx) 
  {
      this.context = ctx;
      DBHelper = new DatabaseHelper(context);
  }
  
  private static class DatabaseHelper extends SQLiteOpenHelper 
  {
      DatabaseHelper(Context context) 
      {
          super(context, DATABASE_NAME, null, DATABASE_VERSION);
      }
  
      @Override
      public void onCreate(SQLiteDatabase db) 
      {
          db.execSQL(DATABASE_CREATE);
      }
  
      @Override
      public void onUpgrade(SQLiteDatabase db, int oldVersion, 
      int newVersion) 
      {
          Log.w(TAG, "Upgrading database from version " + oldVersion 
                  + " to "
                  + newVersion + ", which will destroy all old data");
          db.execSQL("DROP TABLE IF EXISTS titles");
          onCreate(db);
      }
  }    
  
  //---opens the database---
  public Helper open() throws SQLException 
  {
      db = DBHelper.getWritableDatabase();
      return this;
  }
  
  //---closes the database---    
  public void close() 
  {
      DBHelper.close();
  }
  
  //---insert a title into the database---
  public long insert(String name) 
  {
       ContentValues initialValues = new ContentValues();
       initialValues.put("Name", name);
      return db.insert(DATABASE_TABLE, null,initialValues);
  }
  //---updates a title---
  public long update(String name)
          {
              ContentValues args = new ContentValues();
              args.put("Name",name);
  
              return db.update(DATABASE_TABLE, args, 
                               "Name" + "=" + name, null);
          }
  
  
  //---deletes a particular title---
  public int delete(String name) 
  {
     // return db.delete(DATABASE_TABLE,"Name="+name, null);
      return db.delete(DATABASE_TABLE,"Name=?",new String[]{String.valueOf(name)});
  }
  </code></pre>
  
  <p>}</p>