Android Question Best Practices in Class

josejad

Expert
Licensed User
Longtime User
Hi all:

My first app was a long list of subs in Main module, and in order to reduce the amount of subs, the app was divided in several Activities. (I know it can be good in some cases)

I understood what a class is, but I couldn't see how can move my small subs to them.

But when I saw this screen from this post

upload_2019-7-1_12-1-36-png.81759

I thought, so elegant...

Then, in the app I'm doing, I need four B4XTable editables, and then I saw it clearly. I created a class to add different B4XTables and I understood how it works.
Well, in this situation, it's clear to me (I hope not being wrong) I need a class to reuse the code for having several B4XTables.

But now I want to move the code of CameraEx to a class, to move the camera subs to that class and maintain my Activity code more clear. I just need one camera.
I want a camera panel into a TabStrip, so I need a layout to load in the TabStrip with a panel. I pass this panel to my camera class, and then my class pass that panel to the CameraEx class.

Is this the rigth way of doing this? Or should I add the camera events (Camera1_Ready ...) to the CameraEx class?
Or should I use CameraEx class directly and put my code into a #Region to maintain it clear?

I hope I've explained it well.

Thanks again.
 
Top