앱 내 갤러리를 따로 만들려고 코드를 찾아 해봤는데 null array 오류라고 하네요ㅠ
CustomGalleryAdapter.java 중에 getCount의 mImgs.length에서 오류가 발생했습니다ㅠ
public class CustomGalleryAdapter extends BaseAdapter {
int CustomGalleryItemBg;
String mBasePath;
Context mContext;
String[] mImgs;
Bitmap bm;
public String TAG = "Gallery Adapter :: ";
public CustomGalleryAdapter(Context mContext,String basepath) {
this.mContext = mContext;
this.mBasePath = basepath;
File file = new File(mBasePath);
if(!file.exists()) {
if(!file.mkdirs()) {
Log.d(TAG,"failed to create dir");
}
}
mImgs = file.list();
TypedArray array = mContext.obtainStyledAttributes(R.styleable.GalleryTheme);
CustomGalleryItemBg = array.getResourceId(R.styleable.GalleryTheme_android_galleryItemBackground,0);
array.recycle();
}
@Override
public int getCount() {
return mImgs.length;
}
위의 activity.java에서는 customGallery.setAdapter(custom~); 여기서 문제가 생기네요ㅠadapter의 문제 때문이겠죠..도와주시면 감사하겠습니다..ㅠ