• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to pass a growing array to onSaveInstanceState

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I take the 4 pictures (see the loop in dispatchTakePhotoIntent) and add each to the Uri Arraylist (see last line in onActivityResult); the array comes back to me blank. I was wondering if this has to do with the rotating screen when taking a picture (the program is in landscape). I understand that onSaveInstanceState could fix this. How do I pass the ArrayList<Uri> to the saveInstanceState?


and my takePhotoIntent is:
   
 
Bartender
Posts: 598
26
Oracle Notepad Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
onSaveInstanceState() uses a Bundle object to store data, and that Bundle is sent to OnRestoreInstanceState(). The Bundle has the appropriate methods to store and retrieve an array.
 
L Vasquez
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Brian Tkatch wrote:onSaveInstanceState() uses a Bundle object to store data, and that Bundle is sent to OnRestoreInstanceState(). The Bundle has the appropriate methods to store and retrieve an array.



But how about an ArrayList of URIs specifically?
 
Brian Tkatch
Bartender
Posts: 598
26
Oracle Notepad Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

L Vasquez wrote:But how about an ArrayList of URIs specifically?


Isn't that parceable? If so, you can use putParcelableArrayList().
 
L Vasquez
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Brian Tkatch wrote:

L Vasquez wrote:But how about an ArrayList of URIs specifically?


Isn't that parceable? If so, you can use putParcelableArrayList().



Just like this?

 
Brian Tkatch
Bartender
Posts: 598
26
Oracle Notepad Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

L Vasquez wrote:Just like this?


I admit my lack of knowledge here. That definitely looks right though. Now, grab the Bundle from onRestore... and see if you get the array.

Oh, and i don't know if it matters, but i'd put the super first.
 
You can't have everything. Where would you put it?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic