Info

1418-9 Android S iOTEPi5»J

1418-9 Android S iOTEPi5»J

5. fiif

J^i&^HiJMf WScffl. ftffiffl title E^Stj^

fi/T-ftfi1 /MSTW onClick #

Piiin FJTr*:

private void showItemsO {

SQLiteDatabase db müpenHelper.getReadableDatabase(); String col I] = ( TITLE, BODY \;

Cursor cur - db.query (TABLENAME, col, null, null, null, null, null);

Integer num = cur.getCount();

setTitle (Integer. toString (num) ♦ " jfcifi^1*) ;

• SQLiteDatabase db = mOpenHelper.getReadableDatabase()i&6] i'-ftU&i ^"PJftöftltW.

• Cursor cur = db.query(TABLE NAME, col, null, null, null, null, nullJifi'öJ^Ä WÄfKlftftSjftilJ t Cursor + ö Cursor jT&t»«* TABLE NAME S^fW/irft&flJ. query()

• $ ^»mmmwm.mj&'-f-, imft.mn^m r-. table.name, tli«fcSMdiary"o

• ss --r-mifeirj«ii»i«c«i^ri<j^un<jftibo {"^vmmmmmmi title, bodyo

• selection, fflST SQL gHUCHj where SSI!Xl null.

• selectionArgSo A selection Mi"?", JlP&ft selectionArgs

JfeXMiflWitfCg selection + "?"„

• Integer num = cur.getCount()iMOiffiH getCount()A7i, bJ" WWi'J Cursor Mi'l'

/'hiflifi : Cursor 4 Android P. 4 it Cursor ftif] ttXiAft

-zmmmmfn, (title)

!S, Usfltiwffl 8-i2rr^W#Bfi.

a m 8-11 A & 8-12 j^JM-^ie^

«tfJMTTllMr»P.W onClick t&ftifr;,fi iftdeleteltem 7/vi.T KfWittJ FW^:

private void deieteltem() ( try (

SQLi teDatabase db mOpenHelper . getWri table-Database () ;

//mrmtetoft db. delete (TABLE_NAME, " title ' haiyang"', null);

seLTitie ( "flfrjl^ title % haiyang ;

• db.delete(TABLE NAME, " title = 'haiyang"\ null)i& njffi«]|& T & title^haiyang'lft <, ^mtrn title fißÄ'haiyang*. WyA -tf-Mfö. ffiffJXi delete Jii^SÜM/W K

ftm o

0 0

Post a comment