How can I pass a class object from Activity to a class to be able to call its methods?

60 Views Asked by At

I need to create an object of the BLE class in the Activity, in onCreate, I tried to implement it with Parcel (passing the object via Intent), but I have an application crash from it.

As it turned out, the reason was that in the BLE class when I accept The content:

mDeviceListAdapter = getEnableIntent().getParcelableExtra("lVAdapter");
mDeviceListAdapter == null

Later I learned that the Intent serves to transfer data only in the onCreate from one Activity to another.

Please tell me how I can transfer objects of the created classes to other classes (not Activity). Thankful in advance.

0

There are 0 best solutions below