I am trying to improve my app design a little. It is basically a workout app that starts music when you should run, and handles running intervals.
My current app works, but it is very messy and it does not conform to good coding practices, which is why I really want to change it.
As of now this is done through MainActivity. Then I "hacked" together a navigation drawer (ND) implementation using activities because the ND normally require fragments to work, but everything was working with Activities so I wanted to keep the code.
The current classes of interest are:
- MainActivity
- Workout
- MediaPlayer
- BaseActivity (Used to get ND to work with activities. See here)
- NavigationDrawerItem
- NavigationDrawerListAdapter
- PlaylistActivity (navigated to via the ND)
- TracklistActivity (navigated to via the ND)
I experimented using Fragments, but I found out that navigation using fragments killed the running workout/media playback. So my approach was off.
As of now the workout/media class calls callback methods in the MainActivity which makes it updates its UI. How could I do this with a service?
I am wondering what is the best way to implement this? Should I use a MainActivity together with Fragments for the navigation drawer, and then implement a Service/IntentService that handles the workout and media related code?
Aucun commentaire:
Enregistrer un commentaire