Sam Javed
Sam Javed

Reputation: 115

Android application with only one Activity

Is it bad programming if I use only one Activity for a game like pong? I have different classes to do different tasks and handle touches etc. but I only have one main Activity which changes what is drawn on screen based on user input. I currently only have three views.

Should I use different Activities for all these views or is one MainActivity fine to handle all of them?

Upvotes: 0

Views: 472

Answers (2)

Rod_Algonquin
Rod_Algonquin

Reputation: 26198

If you are just going to change view within your activity, you can always use Fragments rather than Activities. Having multiple activities means that you are going to destroy your data and view every time you change the View.

Upvotes: 2

JRowan
JRowan

Reputation: 7104

Id say one activity to handle all of the views in a pong game is fine, if you put the views in seperate activitys they wouldnt all be able to work in one activity at the same time it just wouldnt make sense, one activity to handle all the views in a pong game sounds right now maybe if you had a title screen or options screen you could use different activitys for that

Upvotes: 1

Related Questions