A brief overview: It's a coffee brewing app and each coffee has a bunch of steps as well as things like temperatures etc that are populated in a timed list. These 'recipes' are all in JSON which I then go through and create Coffee objects.
Once my code for creating the many Coffee objects is complete, I currently store them all in an array.
My app shows a few lists, the first list shows the coffee type, the second list shows the various recipes for that coffee and the last is the steps themselves.
As the user clicks through each list I store the value of the list Item in the Coffee Class (e.g. chosenCoffeeID) and then when the second list is tapped it's again stored as (chosenRecipeID). This then allows me to grab the correct object from the array when it comes to populating the data from it. i.e. if chosenCoffeeID = 2 and chosenRecipeID = 5 then I use it like: coffeeObject.getRecipeTitle(); etc etc.
I'm not sure this is the best way. I keep coming up with other solutions that might work better. Using sharedPreferences for example to store both the values which allow me to get the correct coffeeObject out of the array.
Another option is to have a singleton and maybe have static final for the chosen coffee and recipe and then get this instead?
I'm confused on how I should be approaching this, currently my app crashes when it's been in background for a while. A null pointer error on an array, probably from something being garbage collected.
sorry for the long post, my head is a bit jumbled and it's difficult for me to explain when i'm a bit out of my own depth. :)
That's right people Flowers The Beautiful Meadow has finally been released!!
An addictive, fast paced arcade game suitable for all the family, challenge your reaction times, hand eye coordination and your trigger finger, in this exciting free to play IOS title!"
Get it on the app store here:
And visit the website here:
- Limeleaf WeddingsPhotographer, present
- Limeleaf MediaPhotographer, Videographer, Editor, present
Lime Leaf Photography, Byfleet, Byfleet, West Byfleet, Surrey
London wedding, family and commercial photographer.
Google Lat Long: Get on the road, go off the grid, or plan the perfect w...
Tuesday, May 6, 2014 at 8:53 AM. When your life is moving fast, you need tools to keep up with your pace. Google Maps for mobile is the perf
Android 4.4.3 KTU84F to Begin Rolling Out to Nexus 5 Today
You may recall that we've seen quite a few Android 4.4.3 test builds pop up recently. But now, at least according to US third-place carrier