Tips on refactoring an Android prototype
Posted
by
Brad
on Stack Overflow
See other posts from Stack Overflow
or by Brad
Published on 2012-06-08T04:21:51Z
Indexed on
2012/06/08
4:40 UTC
Read the original article
Hit count: 145
I have an Android project I've inherited from another developer.
The original code was hacked together using a single View and a single Activity. The view class has a State variable that is switched on during input and rendering.
Each "screen" is a single bitmap rendered directly onto the screen. There are no layouts used at all. To make things even worse each variable in both the View and Activity classes were all declared public static and would access each other frequently.
I've reworked the code so it is now somewhat manageable, but it's still in those original two classes. This is my first decently sized Android app so I'm not completely sure where to go next.
From the looks of things, each "screen" should have its own View and Activity. Is this the general practice?
If so I need some way to share data between the separate Activities. I've read suggestions to use a Singleton class that holds generic data. Is there any other ways that are more built into the Android framework?
Thanks in advance.
© Stack Overflow or respective owner