I've an embedded database file(Apple computers.db in assets directory) of MAC addresses during my application.The database is an extremely simple sqlite database with only one table. The table named mactoname has two posts: 1. macaddress, 2.title. You will find some preloaded mac addresses and names within this embedded database file. I've got a wi-fi compatability analyzer tool to identify mac addresses inside a place. The code with this analyzer is offered below(from marakana.com):

public class WiFiScanner extends Activity {

            TextView name;
            TextView textView;
            WifiManager wifi;
            BroadcastReceiver receiver;
            Button buttonScan,updatemacdb;

            @Override
            public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);

                setContentView(R.layout.scannerwifi);

                textView = (TextView) this.findViewById(R.id.wifitext);
                buttonScan = (Button) findViewById(R.id.buttonScan);
                updatemacdb=(Button) findViewById(R.id.buttonupdatezoneDB);
                wifi = (WifiManager) this.getSystemService(WIFI_SERVICE);
                name=(TextView) this.findViewById(R.id.edittextname);

                buttonScan.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View view) {
                        wifi.startScan();

                    }
                });
                updatemacdb.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View view) {


                    }
                });
                if (receiver == null)
                    receiver = new WiFiScanReceiver(this);

                registerReceiver(receiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));

                populate();

            }

            private void populate() {
                String text = "";
                List<ScanResult> access_points = wifi.getScanResults();
                for(int i = 0 ; i < access_points.size() ; i++){
                    ScanResult ap = access_points.get(i);
                    text += "#SSID: " + ap.SSID + "/MAC: " + ap.BSSID + "\n\n";
                }
                textView.setText(text);
                Log.d("Wifi Display", text);

            }


            class WiFiScanReceiver extends BroadcastReceiver {

                WiFiScanner wifiScanner;

                public WiFiScanReceiver(WiFiScanner wifisc) {
                super();
                this.wifiScanner = wifisc;
                }

                @Override
                public void onReceive(Context c, Intent intent) {
                    wifiScanner.populate();
                }
            }
            public void onBackPressed() {
                unregisterReceiver(receiver);
            }   
        }

now, when i identify the mac addresses i wish to update the Apple computers.db by putting the detected mac addresses in to the Apple computers.db file. the update ought to be done on following button click:

updatemacdb.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {


            }
        });

if your mac address already is available then it won't be place in Apple computers.db again. Along with detected new mac addresses within the macaddress coulmn, the title typed by user within the edittext view is going to be up-to-date within the title column of mactoname table in Apple computers.db, too. I've an implementation of SQLiteOpenHelper class. What codes will i need inside this assistant class and inside OnClickListener of updatemacdb button to be able to update the database with new mac addreses and names ?

my SQLiteOpenHelper class is offered below.Which techniques should i modify within this class?

public class DbAdapternew {
    private static final String TAG = DbAdapter.class.getName();
    private DatabaseHelper mDbHelper;
    public static SQLiteDatabase myDb;
    public static String DATABASE_NAME;
    public static String DATABASE_TABLE;
    public static String DATABASE_PATH;
    public static String LOCAL_DATABASE_NAME;
    private static final int DATABASE_VERSION = 2;
    private static Context myContext;

    private static class DatabaseHelper extends SQLiteOpenHelper {


        Context helperContext;

        DatabaseHelper(Context context) {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
            helperContext = context;
        }


        @Override
        public void onCreate(SQLiteDatabase db) {
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
            Log.w(TAG, "Upgrading database!!!!!");
            onCreate(db);
        }

        public void createDataBase() throws IOException {
            Log.i(TAG,"DB NAME : "+DATABASE_NAME);
            Log.i(TAG,"DB PATH : "+DATABASE_PATH);
            Log.i(TAG,"LOCAL DB NAME : "+LOCAL_DATABASE_NAME);


            boolean dbExist = checkDataBase();
            if (dbExist) {
            } else {
                this.getReadableDatabase();
                try {
                    copyDataBase();
                } catch (IOException e) {
                    //throw new Error("Error copying database");
                }
            }
        }

        public SQLiteDatabase getDatabase() {
            String myPath = DATABASE_PATH + DATABASE_NAME;
            return SQLiteDatabase.openDatabase(myPath, null,
                    SQLiteDatabase.OPEN_READONLY);
        }

        private boolean checkDataBase() {
            SQLiteDatabase checkDB = null;
            try {
                String myPath = DATABASE_PATH + DATABASE_NAME;
                checkDB = SQLiteDatabase.openDatabase(myPath, null,
                        SQLiteDatabase.OPEN_READONLY);
            } catch (SQLiteException e) {
            }
            if (checkDB != null) {
                checkDB.close();
            }
            return checkDB != null ? true : false;
        }

        private void copyDataBase() throws IOException {

            Log.i(TAG,"LOCAL DB NAME : "+LOCAL_DATABASE_NAME);
            // Open your local db as the input stream
            InputStream myInput = myContext.getAssets().open(LOCAL_DATABASE_NAME);

            // Path to the just created empty db
            String outFileName = DATABASE_PATH + DATABASE_NAME;

            // Open the empty db as the output stream
            OutputStream myOutput = new FileOutputStream(outFileName);

            // transfer bytes from the inputfile to the outputfile
            byte[] buffer = new byte[1024];
            int length;
            while ((length = myInput.read(buffer)) > 0) {
                myOutput.write(buffer, 0, length);
            }

            // Close the streams
            myOutput.flush();
            myOutput.close();
            myInput.close();
        }

        public void openDataBase() throws SQLException {
            // Open the database
            String myPath = DATABASE_PATH + DATABASE_NAME;
            myDb = SQLiteDatabase.openDatabase(myPath, null,
                    SQLiteDatabase.OPEN_READWRITE);
        }

        @Override
        public synchronized void close() {

            if (myDb != null)
                myDb.close();

            super.close();

        }
    }


    public DbAdapternew(Context ctx) {
        this.myContext = ctx;
    }

    public DbAdapternew open() throws SQLException {
        mDbHelper = new DatabaseHelper(myContext);

        try {
            mDbHelper.createDataBase();
        } catch (IOException ioe) {
            throw new Error("Unable to create database");
        }

        try {
            mDbHelper.openDataBase();
            mDbHelper.copyDataBase();
        } catch (SQLException sqle) {
            throw sqle;
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return this;

    }

    public void close() {
        mDbHelper.close();
    }

    public Cursor fetchAllData(String table) {

        try {
            myDb.rawQuery("SELECT * FROM " + table, null);
            Log.i(TAG, "Row Collected");
        } catch (SQLiteException e) {
            myDb.execSQL("CREATE TABLE IF NOT EXISTS " + table
                    + " (mac_add VARCHAR)");
            Log.i(TAG, "TABLE Not Found");
        }
        return myDb.rawQuery("SELECT * FROM " + table, null);
    }

    public Cursor fetchData(String sqlQuery) {

        try {
            myDb.rawQuery(sqlQuery, null);
            Log.i(TAG, "Query Executed");
        } catch (SQLiteException e) {
            Log.i(TAG, e.toString());
        }
        return myDb.rawQuery(sqlQuery, null);
    }

    public void executeQuery(String sql) {
        myDb.execSQL(sql);
    }
     public static SQLiteDatabase getWritableDatabase() {
         String myPath = DATABASE_PATH + DATABASE_NAME;
         return SQLiteDatabase.openDatabase(myPath, null,
                 SQLiteDatabase.OPEN_READONLY);
     }
}