我正在尝试将网页的favicon添加到sqlite数据库,但在尝试通过java.lang.NullPointerException
将favicon保存到ByteArrayOutputStream
时,我得到Bitmap.compress
。
我的代码片段是:
Bitmap bitmap = view.getFavicon();
mySQLiteAdapter.openToWrite();
ByteArrayOutputStream byteArrayBitmapStream = new ByteArrayOutputStream();
bitmap.compress(CompressFormat.PNG, 0, byteArrayBitmapStream);
byte[] bArray = byteArrayBitmapStream.toByteArray();
String[] comments = new String[] {view.getUrl()};
String[] commentss = new String[] {view.getTitle()};
int nextInt = new Random().nextInt(1);
try{
mySQLiteAdapter.insert(bArray, commentss[nextInt], comments[nextInt]);
}catch (Exception e) {
e.printStackTrace();
}
mySQLiteAdapter.close();
为什么我收到此错误?