Ok.. so here's a function in my source core called previewCapturedImage
private void previewCapturedImage(){
Log.d("ChildCount", "content child count before:" + mSelectedImagesContainer.getChildCount());
mSelectedImagesContainer.removeAllViews();
Log.d("ChildCount", "content child count after:" + mSelectedImagesContainer.getChildCount());
Iterator<Uri> iterator = mMedia.iterator();
ImageInternalFetcher imageFetcher = new ImageInternalFetcher(this, 500);
while (iterator.hasNext()) {
Uri uri = iterator.next();
// showImage(uri);
Log.i(TAG, " uri: " + uri);
if (mMedia.size() >= 1) {
mSelectedImagesContainer.setVisibility(View.VISIBLE);
}
View imageHolder = LayoutInflater.from(this).inflate(R.layout.media_layout, null);
// View removeBtn = imageHolder.findViewById(R.id.remove_media);
// initRemoveBtn(removeBtn, imageHolder, uri);
ImageView thumbnail = (ImageView) imageHolder.findViewById(R.id.media_image);
if (!uri.toString().contains("content://")) {
// probably a relative uri
uri = Uri.fromFile(new File(uri.toString()));
}
imageFetcher.loadImage(uri, thumbnail);
mSelectedImagesContainer.addView(imageHolder);
// set the dimension to correctly
// show the image thumbnail.
int wdpx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 150, getResources().getDisplayMetrics());
int htpx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, getResources().getDisplayMetrics());
thumbnail.setLayoutParams(new FrameLayout.LayoutParams(wdpx, htpx));
}
}
In the second line mSelectedImagesContainer.removeAllViews();, i am trying to clear the view of all existing children views. but it is not working as expected. So basically this parent container mSelectedImagesContainer has a horizonal list of images that was passed from one more activity.
Also the output of the logging is accurate, it clears all the childviews but for some reason main activity still shows the old images that were previously selected in the viewgroup.
If anything else is needed please let me know. I have not posted the full code since it's quite large. Anyways, if needed i can post it here with the XML's.
Just an info, i am working on a poly-clicker library, for the image picker and a custom scroll view for images.
Screenshots
