Saturday 15 March 2014

android - How to deal with CurpsorAdapter in connection with SQLCipher -



android - How to deal with CurpsorAdapter in connection with SQLCipher -

i'm trying set encypted sqlite3 database in adroid.

i tried 6 steps commonsware suggested in encrypt sqlite database android:. of worked fine. problem there seems no corresponding class android.widget.cursoradapter.

so when seek implement class besucheadapter extends cursoradapter next message:

the method bindview(view, context, cursor) of type besucheadapter must override or implement supertype method.

at lot of other places in project, when seek cursor adapter

final cursor cursor = adapter.getcursor();

i hint:

type mismatch: cannot convert android.database.cursor net.sqlcipher.cursor.

any ideas can do?

package net.krankenhauspfarrer.besuche; import net.sqlcipher.cursor; import android.content.context; import android.util.log; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.cursoradapter; import android.widget.textview; public class besucheadapter extends cursoradapter { //für die anzeige der aktuellen patienten private layoutinflater inflator; private int cip, cist, ciraum, cisex, ciname, cigeb, cikat, cilb, cihint; @suppresswarnings("deprecation") public besucheadapter(context context, cursor c) { super(context, c); log.d("besuche","besucheadapter vor constructor"); //date = new date(); // inflator = layoutinflater.from(context); cip = c.getcolumnindex(dbhandler.main_p); cist = c.getcolumnindex(dbhandler.main_st); ciraum = c.getcolumnindex(dbhandler.main_raum); cisex = c.getcolumnindex(dbhandler.main_sex); ciname = c.getcolumnindex(dbhandler.main_name); cigeb = c.getcolumnindex(dbhandler.main_geb); cikat = c.getcolumnindex(dbhandler.main_kat); cilb = c.getcolumnindex(dbhandler.main_lb); cihint = c.getcolumnindex(dbhandler.main_hint); } @override public void bindview(view view, context context, cursor cursor) { textview tvp = (textview) view.findviewbyid(r.id.listp); textview tvst = (textview) view.findviewbyid(r.id.listst); textview tvraum = (textview) view.findviewbyid(r.id.listraum); textview tvsex = (textview) view.findviewbyid(r.id.listsex); textview tvname = (textview) view.findviewbyid(r.id.listname); textview tvgeb = (textview) view.findviewbyid(r.id.listgeb); textview tvkat = (textview) view.findviewbyid(r.id.listkat); textview tvlb = (textview) view.findviewbyid(r.id.listlb); textview tvhint = (textview) view.findviewbyid(r.id.listhint); int p = cursor.getint(cip); tvp.settext (string.valueof(p)); string st = cursor.getstring(cist); tvst.settext(st); string raum = cursor.getstring(ciraum); tvraum.settext(raum); string sex = cursor.getstring(cisex); tvsex.settext(sex); string name = cursor.getstring(ciname); tvname.settext(name); long gebms = cursor.getlong(cigeb); //date.settime(timemillis); tvgeb.settext(bhelper.resolvebesuchedate2string(gebms, bhelper.rd_short)); string kat = cursor.getstring(cikat); tvkat.settext(kat); long lbms = cursor.getlong(cilb); //date.settime(timemillis); tvlb.settext(bhelper.resolvebesuchedate2string(lbms, bhelper.rd_short)); string hint = cursor.getstring(cihint); tvhint.settext(hint); } @override public view newview(context context, cursor cursor, viewgroup parent) { log.d("besuche","besucheadapter vor textviewnew"); homecoming inflator.inflate(r.layout.besuche_zeile, null); }

yo have implement cursoradapter method android sql cursor (android.database.cursor). works don't using sqlcipher.

public void bindview(view view, context context, cursor cursor) { //do cursor }

we using sqlcipher in our project , works this. no need implement adapter class or something.

net.sqlcipher.cursor extension class android.database.cursor providing gettype method sqlcipher internally uses: net.sqlcipher.cursor on github

note: cannot cast sqlcipher.cursor because contentresolver internally wraps cursor in cursorwrapperinner instance has closeguard informs if did not close cursor correctly. don't need cast. have utilize , if contentprovider implementation correctly uses net.sqlcipher.cursor fine.

android sqlite encryption sqlcipher

No comments:

Post a Comment