Start a new topic

AR.ImageResources become invisible after call to architectView.onResume()

AR.ImageResources become invisible after call to architectView.onResume()

Hi,

I have the following situation:

I have a ArchitectView on an activity within a tab of a TabActivity. In the onPostCreate() callback of the activity I load a world with a call to architectView.callJavascript(). Five AR.ImageResources and AR.Labels are created and are visible. When I select another tab of the TabActivity and then switch back to the tab containing the ArchitectView I briefly see the images reappear but then they disappear (sometimes only one image stays visible and all the other images disappear). The labels on the same GeoObject remain visible. In the onResume() callback of the activity I call "this.architectView.onResume();". Within this call the following message is logged in LogCat (five times in a row):

"E/imageLoaded(12439): Activity is already finishing -> do not fire 'imageInterface.finishedLoadingImage()'"

The "errorLoadingImage()" callback of the AR.ImageResource is not called.

Does anyone know what can cause the images to become invisible?

I use a licensed version of Wikitude 1.0.5. The problem happens on HTC Desire S with Android 2.3.5, HTC Desire with Android 2.2 and Sony Xperia with Android 2.3.7.

Thanks,
Maarten
Hi Maarten,

TabActivity is deprecated, please try v4 support library's Fragments instead.
http://developer.android.com/reference/android/app/TabActivity.html


I guess the issue is related to the fast life-cycle status changes that may apply in TabActivities.

Please let me know if that helped.
Sorry for inconveniences,

Kind regards,
Andreas
Hi Andreas,

Thanks for your answer. I implemented the deprecated TabActivity as a FragmentActivity and the tab containing the ArchitectView as a Fragment now. When I go to this tab the first time everything works fine, but when I switch to another tab and go back to the tab containing the ArchitectView the location of the ArchitectView remains black (this is unlike the behavior in other tabs containing other kind of views). I think that this problem has something to do with the "rewiring" of the lifecycle callback methods.

When the ArchitectView was on an Activity the onCreate()/onDestroy()/onPause()/onPostCreate()/onResume() callback methods of the Activity could be rewired to their ArchitectView equivalents. But the lifecycle of a Fragment is somewhat different from the lifecycle of an Activity.

Currently I have the onPause(), onResume() and onDestroy() callbacks of the Fragment rewired to their ArchitectView equivalents. Both the architectView.onCreate() and architectView.onPostCreate() are called from the fragments OnActivityCreated() (the architectView.onCreate() callback can not be called from the fragments onCreate() callback because the content view is not yet available at that time, and Fragments don't have a onPostCreate() callback).

Is this the correct thing to do? 

Thanks,
Maarten
Hello!

Basically your approach on integrating the ArchitectView lifecycle methods into the fragment seems fine. Actually we use a quite similar approach in our applications and it works fine. What you could try is to put the loading methods of your app into the onResume() method of the fragment and the Architect's onDestroy() method into the onPause() method of the fragment. In that way the architectworld is unloaded in onPause() and reloaded in onResume(). Keep in mind that with this approach the state of your Architect world is not maintained..

We made some changes to the internal handling of the lifecycle methods for our newly released ARchitect 1.1 SDK so if that doesn't help you could try it as well with our new version.

Markus
Hi Maarten,

TabActivity is deprecated, please try v4 support library's Fragments instead.
http://developer.android.com/reference/android/app/TabActivity.html


I guess the issue is related to the fast life-cycle status changes that may apply in TabActivities.

Please let me know if that helped.
Sorry for inconveniences,

Kind regards,
Andreas
Login or Signup to post a comment