Jonnie Grieve Digital Media: Website Blog.

Archived Posts: Android Development Archives – Jonnie Grieve Digital Media posts.

100 Days of Code: Day 4 Write-up

I went back to Android Development today and the biggest challenge for me, hooking up the ListView with and Android adapter.  For the longest time I didn’t think I was going to get much done, with my connection speed and my struggles with the more complicated aspects of Android like ListAdapters.

The time served as a refresher for me on these things, for example that aListAdapter, a kind of bridge between the list view and the class that converts the view into data behind the scenes.

 

After having typed this all in I thought to myself… “Okay. Progress. I think I’ll leave it here for today”.

Today was another tricky time because I’ve been following on, from Treehouse trying to make this Golf Scorecard App. But I always knew this was going to be the toughest part because I just don’t have enough Android knowledge to attempt this part on my own. I was supposed to be attempting it myself before following the video but, I felt I couldn’t.

Part of that is my Dyspraxia, the other is just not having enough time in the day to practice and build up the self-confidence that I need. I thought, many times about just giving up and accepting I’m not cut out for this. But giving up is always the easy way out and I’m not giving up on my dream of making my own app. One way or the other, I’ll do it.

On the plus side, however, I’m really pleased that having followed on with the code, made my list adapter, I was able to get rid of an exception that caused the emulator to crash the app.

It took a little bit of research and carefully reading the exception runtime errors, and runtime errors generally scare me.

It went away after I assigned the list view its special id

android.R.id.list   and in the XML @+id/android:list

Now, I’m going to have to take some time to read through the code I just typed in and see if I can get some things to tick. But I can see a little bit more how practice can get you more familiar with Android Studio’s behaviours and make you more comfortable with the program.

So, while I’m still not at the stage where I’m writing my own code comfortably and unaided… all that means is I wouldn’t trust myself to write Android code for an employer but I can learn to get by making my own projects.

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.  🙂

 

 

100 Days of Code: Day 1 Write-up

So, alright, we haven’t much started with coding yet so it is a little bit of a cop out for my first write up. There’s a couple of reasons for this.

Firstly each project needs time to be planned out; you will start an Android project by creating at least an initial outline of how an Android App will look. You will place your Views (or Objects), assign them appropriate ID’s and write XML code.

Secondly, I wanted to spend this time to prepare because at our home at the moment our broadband connections aren’t great and we need good speed for every time we run a Gradle sync and which involves retrieving information the Android Studio API’s. It makes sense for me to make sure the Android Activities are ready as can be for programming.

Lastly, part of the reason I’m doing this “100 Days of code” is an attempt to facilitate my learning process. The course I’m following on Treehouse guides you through the creation process on this app. The idea is to attempt what needs to be done on my own; fix any errors and if needs be, follow the walkthrough and compare it with my own attempts. I certainly don’t intend to create a like-for-like copy of the app and want to give my own take on it.

I’ll be doing the same for my JavaScript forEach side project too and beyond.  We all learn in our own ways and doing things this way allows me to learn in a way that’s best for me.

100 Days of Code: introduction

Hello, welcome to my first post for my 100 Days of code effort. I’m hoping to keep this going for as long as I can and want to see it through although maybe not for 100 consecutive days.

I have a couple of blogs planned that will hopefully explain a bit more about where I’m coming from, the kind of coder I’m going to be and why I want to take this up in the first place.

My social media accounts and blogs are somewhat bare because I’m so focussed on my own projects and I can’t afford anyone to do it for me so this is one thing that’ll help me to keep in touch with you all 🙂

To kick things off there’s a couple of things I’m going to put my focus on. These are an Android App for creating a Golf Scorecard and practicing JavaScript forEach methods. Where else the 100 days of code effort goes I’m not sure but this has been a long time coming so let’s make a go of it.

You can follow my progress from this blog and my GitHub page. 

Those “am I cut out for this?” moments

Am I cut out for this? Why am I even bothering? How can I prove to a client or an employer that I am capable of producing their brief if I’m not capable of doing the simple things?

These are questions I ask myself frequently.

I’ll get the positive bit over with first of all.

Yes, I am cut out for this. I am bothering because I am doing the thing I love the most. I am capable of more than I give myself credit for.

I love making websites and writing code and I love learning more about how to do it better than I was doing it yesterday. I love learning about what’s out there. But more often than not I am finding myself going back to old ground just to refresh myself on what I have learned.

I have to remind myself and retrace my steps just to keep myself on a level playing field with the rest. That’s not me putting myself down. It’s just the way it is. And I’m not saying either that neuro-typical people don’t also struggle with learning coding; taking in what they have learned and having the confidence to put it into practice. But I’ve got what others have in spades.

Let me tell you all what has happened in the last few days that has made me question my abilities yet again.

An Android I was attempting to load a view (or a screen) from the home screen of an app I was learning to develop. There was a problem that not only prevented the screen from loading. It requited one piece of code for each button that loaded the screen.

The answer to the problem was staring me in the face but I couldn’t see it.

In a separate JavaScript project I had a React proptype (i.e. a property of a component in React.js project) declared as a number but was being read by React as a String property. And I had no idea why since the property was clearly defined as a number property.

The answer to the problem was staring me in the face but I couldn’t see it.

In both cases the answer was simple and really was staring me in the face, just screaming “Come on Jonnie, this is easy, work it out”.

But I couldn’t. My brain was just not latching on, no matter how many times I went back and forth through the project. I needed help and the answer spelt out to me by a second pair of eyes.

Of course, asking for help when you need it is never a bad thing. But moments like those, are crushing. The realisation that the bugs in the program were entirely your own doing and easily fixable. And so much time was wasted before finally seeing the light.

This is why sometimes I question whether I’m the best person for this. Because I lack the ability to think outside the box enough times and clearly look at a problem.

There’s only so many times you can look at an error message and fail to read between the lines and take the right action based on what it says.

I do have an “excuse” so to speak for these issues in my Dyspraxia as it influences so much about the way I think and see things but it doesn’t make things feel any better when the self doubt kicks in.

But that’s what makes us all stronger isn’t it? The collective experience of our failures and low moments.

I continue to be motivated by my goals. To learn to be a better developer and programming thinker; to build my business and achieve my dreams.

View my latest blogs on Medium

I’m trialing blog writing on medium for the time being.  If you like you can view my first blogs here,

https://medium.com/@jg_digitalMedia/i-joined-medium-last-night-f21a26e029b4

and here!

https://medium.com/@jg_digitalMedia/android-blog-debugging-an-android-app-fc0ab95ebeac

 

Android and working with Theme Layouts

So  I think I know what’s been going on with Android since I started my journey earlier last month.   I started out learning as I always do with Treehouse. But Android Studio constantly evolves and has gone through many versions since the courses I’m currently taking were released. So, I’ve been working with different Android versions different from Treehouse and my version,  even though to their credit they provided the same versions of the studio they were using to teach.
I’ve been trying to work with RelativeLayouts for Android Preview. Now I can’t know this for sure (because I’ve restarted so many versions of this app to try and retrace my steps) but I have a feeling I’ve been working with a newer layout type called “Coordinator layout” in Android.  I got wind of this when I was trying to add some components in Android Preview that just wouldn’t place where I wanted them to go.  I had an edit text that would only place in one orange dashed area in the to right-hand side of the preview. With Relative Layout positioning, I had far more control over where components would go in the app.
So, for today at least, I’ve had my first complete, untroubled experience with developing on Android as a beginner.  Here’s hoping this continues.