I have four progress
in my fragment and i define them in onActivityResult
like :
if (requestCode == GALLERY_IMAGE1 && resultCode == Activity.RESULT_OK) {
ProgressBar progress = view.findViewById(R.id.progressBar1);
final Uri imageUri = data.getData();
InputStream imageStream = null;
try {
imageStream = getActivity().getContentResolver().openInputStream(imageUri);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
final Bitmap selectedImage = BitmapFactory.decodeStream(imageStream);
bitmap = selectedImage;
image1.setImageBitmap(bitmap);
Log.d(TAG, "onActivityResult: " + progress.getVisibility());
editPhoto("imageName1", progress);
}
if (requestCode == GALLERY_IMAGE2 && resultCode == Activity.RESULT_OK) {
ProgressBar progress = view.findViewById(R.id.progressBar2);
/* bunch of code */
editPhoto("imageName2", progress);
}
in my log line : Log.d(TAG, "onActivityResult: " + progress.getVisibility());
i got 0 value which mean GONE
.
When i try to make it visible in my editPhoto method like :
private void editPhoto(final String imagePosition, final ProgressBar progress) {
progress.setVisibility(View.VISIBLE);
Log.d(TAG, "progress: " + progress.getVisibility());
/* bunch of code */
}
my progress dosen't came Visible and in my log line Log.d(TAG, "progress: " + progress.getVisibility());
i get the same value 0
as above.
what i doing wrong here ?
Well, Thanks @MikeM, my fall with view behaviors, my progress was in frameLayout like:
<FrameLayout
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="left"
android:layout_weight="1"
android:gravity="left">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:id="@+id/progressBar4"
android:visibility="gone"/>
<ImageView
android:id="@+id/editImage4"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="right"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:scaleType="fitXY"
app:srcCompat="@drawable/ic_add_images" />
</FrameLayout>
and i changed it to :
<FrameLayout
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="left"
android:layout_weight="1"
android:gravity="left">
<ImageView
android:id="@+id/editImage4"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="right"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:scaleType="fitXY"
app:srcCompat="@drawable/ic_add_images" />
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:id="@+id/progressBar4"
android:visibility="gone"/>
</FrameLayout>
I didn't know that frameLayout effected from this behavior.