I am trying to update current credits column of the only row in the database using a drop down spinner which gets values from an arraylist. Very unsure about how to go about doing this operation. Thank you for any help in advance. 

**My database code:** 

```
package com.example.parkangel;

import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class UDbHelper extends SQLiteOpenHelper
{
    public static final String KEY_ROWID = "_id";
    public static final String KEY_PFNAME = "payeeFname";
    public static final String KEY_PSNAME = "payeeSname";
    public static final String KEY_CARD = "card";
    public static final String KEY_CREDITS = "credits";

    private static final String DATABASE_NAME = "UserData.db";
    private static final String DATABASE_TABLE = "UserTable";
    private static final int DATABASE_VERSION = 1;

    //private UDbHelper dbHelper;
    //private final Context ourContext;
    private static UDbHelper instance;
    private SQLiteDatabase ourDatabase;

    public UDbHelper(Context context) 
    {   
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    public static UDbHelper getInstance(Context context)
    {
        if (instance == null)
        {
            instance = new UDbHelper(context);  
        }
        return instance;
    }

    @Override
    public void onCreate(SQLiteDatabase db) 
    {
        // TODO Auto-generated method stub
        db.execSQL("CREATE TABLE " + DATABASE_TABLE + " (" +
                KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
                KEY_PFNAME + " TEXT NOT NULL, " + KEY_PSNAME + " 
                                    TEXT NOT NULL, " +
                KEY_CARD + " TEXT NOT NULL, " + KEY_CREDITS + " TEXT 
                                    NOT NULL);");   
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) 
    {

        // TODO Auto-generated method stub
        db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE);
        onCreate(db);
    }

    public synchronized UDbHelper open() throws SQLException
    {
        System.out.println ("running open");
        if(ourDatabase == null || !ourDatabase.isOpen())
        ourDatabase = getWritableDatabase();
        return this;
    }   

    public String getData() 
    {
        // TODO Auto-generated method stub
        String[] columns = new String[] {KEY_ROWID, KEY_PFNAME, KEY_PSNAME,
     KEY_CARD, KEY_CREDITS};
        Cursor  c = ourDatabase.query(DATABASE_TABLE, columns, null, null, 
                    null, null, null);
        String result = " ";

        int iRow = c.getColumnIndexOrThrow(KEY_ROWID);
        int iPFname = c.getColumnIndexOrThrow(KEY_PFNAME);
        int iPSname = c.getColumnIndexOrThrow(KEY_PSNAME);
        int iCard = c.getColumnIndexOrThrow(KEY_CARD);
        int iCredits = c.getColumnIndexOrThrow(KEY_CREDITS);

        for(c.moveToFirst(); !c.isAfterLast(); c.moveToNext()){
            result = result + c.getString(iRow) + " " + 
                         c.getString(iPFname) + " " +
        c.getString(iPSname) 
                       + " " + c.getString(iCard) + " " +

                          c.getString(iCredits) + "\n";
        }
        return result;
    }
}

```

**My main activity code I will be doing the operation through:**

```
package com.example.parkangel;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;

public class Balance extends Activity{

Button add;
TextView display;
Spinner spinner3;
String[] money = {"Select amount", "£1", "£2", "£5", "£10"};    

protected void onCreate(Bundle savedInstanceState) {                
    super.onCreate(savedInstanceState);
    setContentView(R.layout.balance_layout);
    TextView tv = (TextView) findViewById(R.id.firstn);
    UDbHelper db = new UDbHelper(this);
    db.open();
    String data = db.getData();
    db.close();
    tv.setText(data);

    ArrayAdapter<String> adapter3 = new ArrayAdapter<String>(Balance.this,  
    android.R.layout.simple_spinner_item, money);

    spinner3 = (Spinner) findViewById (R.id.moneytoadd);
    spinner3.setAdapter(adapter3);

    add = (Button) findViewById(R.id.topup);

}

public void onClick(View arg0)
{

}

public void updateActivity(View view){
    Intent book = new Intent(Balance.this, BookTicket.class);
    startActivity(book);
}

public void addBalance(View view){
    Intent addB = new Intent(Balance.this, Balance.class);
    startActivity(addB);
}

public void doUpdate(View view){
    Intent upd = new Intent(Balance.this, UpdateTicket.class);
    startActivity(upd);
}
}

```