當前位置:名人名言大全網 - 短信平臺 - android怎樣實現用代碼從數據庫獲取短信內容等等

android怎樣實現用代碼從數據庫獲取短信內容等等

數據庫獲取代碼如下:

String databaseFilename = DATABASE_PATH + "/" + DATABASE_NAME;

File dir = new File(DATABASE_PATH);

if (!dir.exists())

dir.mkdir();

if (!(new File(databaseFilename)).exists()) {

InputStream is = context.getResources().openRawResource(R.raw.jobexam);

FileOutputStream fos = new FileOutputStream(databaseFilename);

byte[] buffer = new byte[8192];

int count = 0;

while ((count = is.read(buffer)) > 0) {

fos.write(buffer, 0, count);

}

fos.close();

is.close();

}

db = SQLiteDatabase.openOrCreateDatabase(databaseFilename, null);