Jonnie Grieve Digital Media: Website Blog.

Check out my very latest blogs. For more on particular topics check out the post categories.

100 Days of Code: Day 2 Write-up

Today I started actually coding  stage of this project. In actuality  this stage was relatively straightforward but I will admit to feeling the blank canvas syndrome.  As it stands only 2 fields needed to be added.  One for stroke label on the app and another to hold an integer for the stroke count. The app is going to need a new Java class file where the code for the functionality will live. Or for the most part at least.

So that’s the next step. I’ll create one in Android Studio.

It’s in this class we do 3 simple tasks.

  • declare fields
  • hole constructor
  • getter and setter methods

Once that is done the object is created. I was a little thrown by how easy this was.  You’ll need to know which data types will be declared and appropriate names for the field but in projects like this, Android Studio will be able to generate the constructor and getter and setter methods for you.

I’ll then initialise an array of Golf Holes.  This will be an array of the type Holes Now this one of the things I got tripped up on.  What the project requires is an declared array of a given number of indexes, not an array of empty strings like I tried to create.

not

And that’s it. I now have a main activity, a list item activity and a Java object that stores Golf stroke counts.  I think what has been done so far covers the very basics of developing an Android App.  We’re moving into some more advanced things next like setting up a List Adapter.  Now, I will attempt this on my own first but I intend to create an app and if I have to follow along to get there… well..  I intend to learn from the inevitable mistakes I’ll make too.  🙂

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *