내 sdcard에서 이미지를 읽고 액티비티 내부의 배열에 경로를 저장하고 잘 작동하며이 판독 값은 메소드 내부에 있습니다. 두 번째로, 나는 다른 활동에서 같은 방법을 호출하지만 커서는 null을 반환합니다 ........ 나는 "this"로 문제가 있다고 말할 수는 있지만, 어디에서 변경해야하는지 파악할 수 없습니다. 메소드의 코드 아래.데이터베이스에서 이미지를 처음 읽을 때 Null 포인터 예외가 발생했습니다.
public void LoadImagesFromSDCard()
{
try
{
String[] projection = {MediaStore.Images.Media.DATA};
ContentResolver cr = this.getContentResolver();
cursor = cr.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,projection,null,null,null);
imageCount = cursor.getCount();
imagePath = new String[imageCount + 1];
cursor.moveToFirst();
int cursor_index = 0;
do
{
int id = cursor.getColumnIndex(MediaStore.Images.Media.DATA);
imagePath[cursor_index++] = cursor.getString(id);
}while(cursor.moveToPosition(cursor_index));
........
난이
Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {
public void onPictureTaken(byte[] imageData, Camera c) {
if (imageData != null) {
Intent mIntent = new Intent();
StoreByteImage(mContext, imageData, 50,"ImageName");
mCamera.startPreview();
setResult(FOTO_MODE, mIntent);
CameraTaken = true;
IS.LoadImagesFromSDCard();
finish();
}
}
};
같은 다른 활동에서 두번째 호출 실제로 이것은 정보 카메라 활동이다. 도움말 : 여기
에 미리 감사는
E/CameraTest(19169): onCreate
E/CameraTest(19169): onResume
E/CameraTest(19169): surfaceCreated
D/CameraHardwareStub( 34): initHeapLocked: preview size=320x240
E/CameraTest(19169): surfaceChanged
D/CameraHardwareStub( 34): initHeapLocked: preview size=320x240
I/ActivityManager( 59): Displayed activity com.android.print/.CameraActivity: 1013 ms (total 1013 ms)
D/AudioSink( 34): bufferCount (4) is too small and increased to 12
I/global (19169): Default buffer size used in BufferedOutputStream constructor. It would be better to be explicit if an 8k buffer is required.
E/Error reading file(19169): java.lang.NullPointerException
E/CameraTest(19169): surfaceDestroyed
E/CameraTest(19169): onStop
아래 링크를 지칭 아래 코드 란 것은 (IS.LoadImagesFromSDCard에서 IS에게) 갖는다 ..... .... –
로그캣을 첨부 할 수 있습니까? – Tony
IS는 LoadFrom ...() .... – jxgn