lundi 9 mai 2016

Unable to set data into database

In this below code im trying get and set data from the data base but during execution im unable set data in the data base ...

SettingUp

mWirelessRouters = WalletWirelessRouter.get(getActivity()).getWirelessRouter(uuid);

onTextChanged Listner

 mBaseStationName = (EditText) v.findViewById(R.id.base_station_name);
    mBaseStationName.setText(mWirelessRouters.getBaseStationName());
    mBaseStationName.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged
                (CharSequence s, int start, int count, int after) {

        }

        @Override
        public void onTextChanged
                (CharSequence s, int start, int before, int count) {
           mWirelessRouters.setBaseStationName(s.toString());
        }

        @Override
        public void afterTextChanged
                (Editable s) {

        }
    });

Note:- In the above code im trying take the base station name from the user and update it in database..There is no issue related view

getWirelessRouter(UUID uuid)

 public WirelessRouter getWirelessRouter(UUID id)
{
    WalletCursorWrapper cursor = queryWireless(
            WalletDbSchema.WirelessRouter.Cols.UUID + " =? "
            , new String[]
                    {
                            id.toString()
                    }
    );

    try {
        if (cursor.getCount() == 0) {
            return null;
        }

        cursor.moveToFirst();
        return cursor.getWirelessRouter();
    } finally {
        cursor.close();
    }
}

queryWireless

 private WalletCursorWrapper queryWireless (String whereClause, String[] whereArgs)
{
    Cursor cursor = mDatabase.query(
            WalletDbSchema.WirelessRouter.NAME,
            null, // Colums - null select all colums
            whereClause,
            whereArgs,
            null, //groupBy
            null, //having
            null // order

    );

    return new WalletCursorWrapper(cursor);
}

If you need any more data please let me know

Aucun commentaire:

Enregistrer un commentaire