so from what i gather, Socket connections are neither serializable or parcelable, but i need to pass a bluetooth connection to another Activity. i do not want to write a Service as a middle man, so please don't post this as a solution. i've heard that there is a way to pass these types of Objects using a custom Application interface, but i cannot, for the life of me, find a working example of this. i've seen plenty of documentation that says something to the effect of "this is possible" but nothing showing how to do it.
Asked
Active
Viewed 5,054 times
1 Answers
6
Define your app class:
class MyApplication extends Application{
// your fields here
}
Add name
attribute to app manifest.
<application android:name=".MyApplication" ../>
Use it in Activity:
MyApplication myapp = (MyApplication) getApplication();

Peter Knego
- 79,991
- 11
- 123
- 154
-
after a little head scratching i got it to work. that's twice i owe you now. thanks. – moonlightcheese Mar 01 '11 at 20:36
-
1See the following link for a detailed description on using Application class [http://stackoverflow.com/questions/708012/how-to-declare-global-variables-in-android] – Martin Apr 13 '16 at 09:15