Android Question Class or Activity, what is better?

Mark Read

Well-Known Member
Licensed User
Longtime User
Maybe a silly question but ...

One app with two activities. The first does lots of things, one of which is taking a screenshot, saving to a file and passing the filename to activity 2. Activity 2 processes the bitmap intensively and returns a list to the first activity.

My question, would activity 2 be better as a class. What benefit would I get from a class?
 

Mark Read

Well-Known Member
Licensed User
Longtime User
Yes, the first activity generates the screenshot and the second activity analyses this screenshot and returns data to the first activity which then updates its screen. The second activity is only normally needed once.

I just wondered if there would be any benefit (speed or comfort) from using a class instead of the second activity,as it it really does is maths.

A footnote. When the app is working correctly, the second activity will not even show a screen, just a progress dialog will be shown from activity 1. At present I am showing the calculations on screen for debugging.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Then maybe a service could be good to do that calculations.
From the service you can raise subs in your main which then updates the ui (progress)
 
Upvote 0
Top