Hi, I'm coming to Java from C/C++ so I am a little bit confused about achieving CPU/Battery/Memory efficiency in Android.
I wonder, what the preferred way to store temporary variables would be in case of the onRecieve() method in BroadcastReciever? I only refer to the variables, which do not persist any data between executions of the onRecieve method. Let's consider the following example: String temp; temp = Double.toString(foo); As far as I can see there are two available options: 1. Store the "temp" within the onRecieve scope. In general, this would help C++ optimizers to achieve a better performance by inlinining or by putting some variables in the stack. However, I'm not sure this is the case in Java/Dalvik. Additionally, the short life of these temporary variables may trigger unnecessary Garage collection in Java, which is costly in terms of the performance/battery. 2. An alternative, would be to put the "temp" within the BroadcastReciever scope. My non-educated :) guess is that this will have less impact on Garbage Collector, and therefore is better. Any help would be greatly appreciated. Best Alex -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en To unsubscribe, reply using "remove me" as the subject.

