0
這些代碼只能捕捉和顯示我拍攝的圖像,而當我按下保存按鈕時,它只會將「註釋標題」保存到我的列表視圖中。當我點擊「註釋標題」時,它不再顯示圖片。我應該添加什麼來保存並更新它?謝謝。如何將圖像保存到sqlite?
protected void onActivityResult(int requestCode, int resultCode, Intent
data) {
if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) {
Bitmap mphoto = (Bitmap) data.getExtras().get("data");
imageviewid.setImageBitmap(mphoto);
}
}
public void takeImageFromCamera(View view) {
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
}
private void saveNote(){
fillNameIfEmpty();
id = DbAccess.addNote(getBaseContext(), etName.getText().toString(), mFileName, DbContract.NoteEntry.TYPE_PHOTO, currentCat);
Toast.makeText(getApplicationContext(), R.string.toast_saved, Toast.LENGTH_SHORT).show();
}
private void updateNote(){
fillNameIfEmpty();
DbAccess.updateNote(getBaseContext(), id, etName.getText().toString(), mFileName, currentCat);
Toast.makeText(getApplicationContext(), R.string.toast_updated, Toast.LENGTH_SHORT).show();
}
謝謝!我會試試這個,你能舉個例子嗎? –