How to transfer a Bluetooth socket to another action using the application interface

so from what I am collecting, the Socket connections are not serializable or legible, but I need to transfer the Bluetooth connection to another Activity. I do not want to write the Service as an average person, so please do not post this as a solution. I heard that there is a way to pass these types of objects using the user interface of the application, but I can not, for life, find a working example of this. I saw a lot of documentation that says something about the impact of β€œit's possible,” but nothing shows how to do this.

+5
source share
1 answer

Define the application class:

class MyApplication extends Application{
    // your fields here
}

Add attribute nameto application manifest.

<application android:name=".MyApplication" ../>

Use it in action:

MyApplication myapp = (MyApplication) getApplication();
+6
source

All Articles