Wednesday, October 23, 2013

500 hours

 After about a year and eight months I have 500 hours of practice in Android programming. I have slowly learned  and relearned a lot. There have been wonderful moments and many frustrating ones. I have created Apps but none of which I felt were good enough to upload to Google play, even as a free app. The good news is that I haven't given up and I continue.
   I am putting the finishing touch on a silly little app that switches images and plays a sound. In this case it goes from a sad face to a happy face and plays a wav file named happyplace . It was from a list of exercise objectives I made when I first started but I put off while I did others. The objective was to have the app display one image and when touched it would switched the image while playing a sound. Then afterwards switch back. There were a number of ways I could do this.
 One way would be to just set image in view and make it clickable which would then change the image while playing sound, all controlled by one main activity class.( which I did)
 A second way would be split up the main view activity and the sound. Putting the sound code in a separate class ( which I also did).
 The first way is the easiest but not very OOPs compliant in which you try to isolate code in to it's own pieces.The second way gave me a bit of trouble since SoundPool requires a Context and I was not sure how to give it one. I first tried by making the Class extend Activity but since the class did not actually have a UI that was not correct. I finally settled on passing getBaseContext when I called MyPlayer.
  One cool thing I learned about was ViewSwitcher. It has a nice animation that can fade in and out when changing Layout. You set up 2 layouts on one xml and it will switch between them.
  A problem I am now working on is having it switch back after the sound has played. As far as I know there is no onCompleteListener for SoundPool. So I tried a timer but I am having a bit of trouble in that it either goes from the first image to the second and back before you can see it or if I set it up another way it waits till the time is up before switching from the first image to the second

10,000 hour to Mastery.
10,000 - 502.5 = 9497.5 hours left
( I know it's going very slow but other obligations prevent me from devoting more time to studying)