我用 Android-Universal-Image-Loader 制作了 gridview
而且,当我选择一张图片时,它会出现在 imageview 上。
当我首先选择它时,它工作正常。但第二个崩溃了。(记不清)
我加载了超过 1M 大小的图像(最初是默认相机拍摄的)
这是初始化的代码
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
.memoryCacheExtraOptions(480, 800) // default = device screen dimensions
.discCacheExtraOptions(480, 800, CompressFormat.JPEG, 75)
.taskExecutor(AsyncTask.THREAD_POOL_EXECUTOR)
.taskExecutorForCachedImages(AsyncTask.THREAD_POOL_EXECUTOR)
.threadPoolSize(3) // default
.denyCacheImageMultipleSizesInMemory()
.memoryCacheSize(2 * 1024 * 1024)
.discCacheSize(50 * 1024 * 1024)
.discCacheFileCount(100)
.enableLogging()
.build();
这是选择它时的获取uri
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// when clicked image
//startImagePagerActivity(position);
//URI imageUri = URI.parse("android.resource://com.kmob.camera/" + parent.getItemIdAtPosition(position));
SignUp.profilePath = Uri.parse(imageUrls[position].substring(7)); // return selected uri except prefix, "file://"
Log.v("OWL", "selected file: " + imageUrls[position].substring(7));
finish();
}
});
这是活动的结果
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
//mProfile.notifyAll();
if(profilePath.getPath().toString().length()>0){
mProfile.setImageURI(profilePath);
}
}
提前致谢,