• 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
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

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.
 
keep an eye out for scorpions and black widows. But the tiny ads are safe.
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic