0

Is it possible to preserve an existing RenderScript instance (and all bound memory) during a screen rotation? If so, how might I go about doing this? From what I understand, it is not necessary to change anything other than projection data, however, in order to ensure that the RenderScript engine is shut down when the application is quit, I need to destroy it in the onDestroy() callback. Is there any other way to do this so that I can persist this through a rotation? For example, through the saved Bundle?

Jared
  • 1,449
  • 2
  • 19
  • 40

1 Answers1

1

Have you tried adding the configChanges->orientation tag to your AndroidManifest.xml? It preserves some instances on rotate

<activity android:name="YourActivity" android:configChanges="orientation"/>

JackMahoney
  • 3,423
  • 7
  • 32
  • 50
  • I have not although after looking at the relevant documentation it seems to be able to accomplish the task. I will attempt to implement it and post the results. – Jared Apr 11 '12 at 22:25
  • I have not had the opportunity to fully implement this yet. The program in question is threaded and I will have to move some stuff around to make sure everything behaves as expected and updates the new window dimensions appropriately. I did however add the tag to the manifest and added the callback with a log message and it doesn't seem to be calling it. I should be able to take a better look at it in the morning, so I will let you know then. – Jared Apr 13 '12 at 06:12
  • It would seem that the system is not notifying my activity for the orientation change. The log in the call back is not being printed and the log messages in the onStop() and onDestroy() callbacks are still printing. Any suggestions? – Jared Apr 13 '12 at 16:13
  • I have accepted this as an answer since the documentation supports it in spite of my inability to implement it yet. – Jared Apr 16 '12 at 21:59