How do I "refresh" my ImageViews when starting an activity using
startActivity?
The problem:
The problem I'm having is that when I go from my main activity to another
activity I have a few ImageViews that simply display .png images. When I
start the app, the main activity is started from the launcher, and upon
tapping one of the image views of this activity it moves the user to
another activity which has other ImageViews. The first time navigating to
this "secondary" activity the ImageViews here are displayed correctly. But
when navigating away from this activity and back to it by tapping the same
icon from the main activity the image views that are associated with this
activity show up "black". I can clearly see that they are "there" but the
.png graphics that are applied to them are not being displayed correctly.
Here is the .xml file that defines the layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".OpenGLMain">
<com.toonCam.main.MainGLSurfaceView
android:id="@+id/mainGLSurfaceView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<!-- Back Button. -->
<ImageButton
style="@style/OpenGLStyle"
android:id="@+id/back_button"
android:src="@drawable/back_button"
android:layout_marginTop="0dip"
android:layout_marginLeft="0dip"
android:scaleX="0.8"
android:scaleY="0.8"
android:onClick="onClick"/>
<!-- Snap Photo Button. -->
<ImageButton
style="@style/OpenGLStyle"
android:id="@+id/snap_photo_button"
android:src="@drawable/snap_photo_button"
android:layout_marginTop="600dp"
android:layout_marginLeft="600dp"
android:scaleX="2.0"
android:scaleY="2.0"
android:onClick="onClick"/>
<!-- Facebook Share Button. -->
<ImageButton
style="@style/OpenGLStyle"
android:id="@+id/share_photo_button"
android:src="@drawable/share_button"
android:layout_marginTop="650dp"
android:layout_marginLeft="1100dp"
android:scaleX="2.0"
android:scaleY="2.1"/>
<!-- Exit Photo Preview Button -->
<ImageButton
style="@style/OpenGLStyle"
android:id="@+id/return_to_camera_button"
android:src="@drawable/return_to_camera_button"
android:layout_marginTop="0dp"
android:layout_marginLeft="0dp"
android:scaleX="1.0"
android:scaleY="1.0"
android:onClick="onClick"/>
<!-- Save Image Button -->
<ImageButton
style="@style/OpenGLStyle"
android:id="@+id/save_image_button"
android:src="@drawable/save_image_button"
android:layout_marginTop="600dp"
android:layout_marginLeft="600dp"
android:scaleX="1.5"
android:scaleY="1.6"
android:onClick="onClick"/>
Also here is a screenshot of what the ImageViews look like when navigating
to this "secondary" activity for the first time:
Here is the screenshot of the what the ImaveViews look like when
navigating to this "secondary" activity for the second time and beyond,
they never look correct again at this point:
No comments:
Post a Comment