Java / Android Coding - Beginners Help

Soldato
OP
Joined
28 Apr 2011
Posts
14,816
Location
Barnet, London
hi andy. can you link to the video training you're bought and howd you'd rate them so far? is something i'd like to do too

The first one I signed up to is this one. It's over 60 hours in content with lots of challenges along the way (which probably at least doubles the course time, if not more). Doing 30 mins to an hour a day, I think this would take around 3 months for me to do. I'm 26% of the way in and it does seem very thorough.

The second one is this one. I feel the guy is explaining more in the early stages and I think I'd have done better to start here and then run the first along side it as I go. Only 12 hours of content, no challenges but a few quiz's. I'm 25% of the way in and at this point it's not covered a lot of what Tim has in the first, but at the same time there's a lot more things that clicked and make sense to me now.
 
Associate
Joined
9 Oct 2009
Posts
845
Location
Somewhere
Cool thread. I got Tim's course a while back and did 10% of the course and whilst I enjoyed it I haven't touched it since (have been very busy) but think I will be going back to it myself and starting again from the beginning. Just having a quick look and new content has been added since the last time I looked too.
 
Soldato
OP
Joined
28 Apr 2011
Posts
14,816
Location
Barnet, London
I agree he's very active in adding new content and answering questions. I recommend take a look at the second one I posted though too. If you get it on sale for £15, it's well worth it.
 
Soldato
OP
Joined
28 Apr 2011
Posts
14,816
Location
Barnet, London
I need some help with today's '30 days of coding' challenge.

I actually thought it was quite easy, but my code gets run time errors from test 2 onwards.

Here's the challenge. Here's my code -

Code:
public class EvenOddString {
    static String[] output = new String[2];
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int numberOfWords = sc.nextInt();
        sc.nextLine();

        for (int j = 0; j < numberOfWords; j++) {
            String string = sc.nextLine();
            int length = string.length();
            String evens = "";
            String odds = "";

            // collect the even letters

            for (int i = 0; i < length; i += 2) {
                evens = evens + string.charAt(i);
            }
            // collect the odd letters

            for (int k = 1; k < length; k += 2) {
                odds = odds + string.charAt(k);
            }
            output[j] = (evens + " " + odds);
        }
        for (int x = 0; x < numberOfWords; x++) {
            System.out.println(output[x]);
        }
    }
}

Any ideas? I'm guessing something is too big for something... but the parameters sat it's never more than 10,000 characters in the string, so int's should be fine. Anything else I'm missing?

** EDIT **

Never mind... I'm a n00b. I limited the string array to 3... set to 10 and all is good :)
 
Last edited:
Soldato
OP
Joined
28 Apr 2011
Posts
14,816
Location
Barnet, London
A small update. I finished the second video course a couple of days ago, so it took me just under 3 weeks, doing an hour or so a day. Mind you, watching video was probably only around a third/half of the time I would spend coding/learning. I've been stopping and taking notes, screenshots (annotated) as I go, to give me something to refer back to.

I'm now back on the first video course (Java Masterclass) with Tim B, and I think things are making a little more sense. I still find Tim sometimes assumes some knowledge when explaining something and loses me.

Right now, while learning about Abstract Classes and Interfaces (I think I have them locked down from the second course tbh) I'm installing the Android Developer Studio and I'm going to make a start into the Android course that Tim has done too. I guess the first 10% or so will be very simple stuff, but I'd like to at least get a look at how Android apps are made now, then we'll see which I'll work through more/quicker, Java or Android.

I'm getting on okay with the 30 Days of Code on HackerRank. It was pleasing today that I managed to do the challenge about Linked List and then Exceptions, pretty much just using my own notes and not needing to look for answers in the 'discussion' tab. Green ticks first time!

So, still enjoying it. Progress feels slow, but it is still progress!
 
Man of Honour
Joined
18 Oct 2002
Posts
13,262
Location
Northallerton/Harrogate
The first one I signed up to is this one. It's over 60 hours in content with lots of challenges along the way (which probably at least doubles the course time, if not more). Doing 30 mins to an hour a day, I think this would take around 3 months for me to do. I'm 26% of the way in and it does seem very thorough.

The second one is this one. I feel the guy is explaining more in the early stages and I think I'd have done better to start here and then run the first along side it as I go. Only 12 hours of content, no challenges but a few quiz's. I'm 25% of the way in and at this point it's not covered a lot of what Tim has in the first, but at the same time there's a lot more things that clicked and make sense to me now.

I signed up for the first one - 60 hours seems great.
Do you still feel it's good to start on/include the second one?

Oh, you pretty much answered that in your post above, which I hadn't read :D
 
Associate
Joined
1 Dec 2008
Posts
267
A small update. I finished the second video course a couple of days ago, so it took me just under 3 weeks, doing an hour or so a day. Mind you, watching video was probably only around a third/half of the time I would spend coding/learning. I've been stopping and taking notes, screenshots (annotated) as I go, to give me something to refer back to.

I'm now back on the first video course (Java Masterclass) with Tim B, and I think things are making a little more sense. I still find Tim sometimes assumes some knowledge when explaining something and loses me.

Right now, while learning about Abstract Classes and Interfaces (I think I have them locked down from the second course tbh) I'm installing the Android Developer Studio and I'm going to make a start into the Android course that Tim has done too. I guess the first 10% or so will be very simple stuff, but I'd like to at least get a look at how Android apps are made now, then we'll see which I'll work through more/quicker, Java or Android.

I'm getting on okay with the 30 Days of Code on HackerRank. It was pleasing today that I managed to do the challenge about Linked List and then Exceptions, pretty much just using my own notes and not needing to look for answers in the 'discussion' tab. Green ticks first time!

So, still enjoying it. Progress feels slow, but it is still progress!

Sounds like you've got a way of learning thats working for you, awesome to hear!

Just thought I'd pitch in with recommendations for the Android side of things, very highly rated book for beginners is the Android Big Nerd Ranch guide, a lot of people I've met used this book to get a really good grasp of all the basics of Android (myself included) as it's very thorough, I can't recommend it enough. I've used the previous edition but I think I read there is a new edition coming out (or has came out in the last year). Thinking back the only negative was maybe the lack of information on testing/architecture but for everything else android, it was the tutorial type learning I've used.

I also did this course too, which is a part of the android nanodegree, I found it pretty useful just to get more of the basics down, it supplemented the book I mentioned pretty well. Also free which is obviously a plus, and endorsed by Google.

https://www.udacity.com/course/new-android-fundamentals--ud851
 
Soldato
OP
Joined
28 Apr 2011
Posts
14,816
Location
Barnet, London
Thanks, for the book there looks to be a new version of Jan 2017 which included Nougat, have added it to my wishlist.

Thanks for the link to the course, I think I've looked at one of them, but would maybe start with the beginners course first.

Beginners says 4 weeks... intermediate says 60 hours? Any idea how that works? 4 weeks doing how much each day? 60 hours or video content?
 
Associate
Joined
1 Dec 2008
Posts
267
Thanks, for the book there looks to be a new version of Jan 2017 which included Nougat, have added it to my wishlist.

Thanks for the link to the course, I think I've looked at one of them, but would maybe start with the beginners course first.

Beginners says 4 weeks... intermediate says 60 hours? Any idea how that works? 4 weeks doing how much each day? 60 hours or video content?
Very sorry mate, it's been about a year since I've done that course so I can't specifically remember how the time is broken up.
 
Soldato
OP
Joined
28 Apr 2011
Posts
14,816
Location
Barnet, London
So not directly linked to Java as the title suggests, but I've published my first (two) Android apps!

https://play.google.com/store/apps/developer?id=AAUK

Yes, the Fart App is very childish and silly, but in my current Android course by Rob Percival a challenge was set around a sound app, so I adapted it a little :) I mainly did it as an experience of publishing an app and it was very interesting, it took three attempts.

1) The image I used I had found through a Google search and clearly Google knew and denied the app for copyright reasons.

2) Switched in my own image. Declined as although the app had a 12 rating (due to the nature of the image, slightly sexual) the icon and screenshots, which can be seen by anyone, not covered by the rating, were not appropriate. (Again, lycra clad buttocks)

3) Success! I blurred the screenshots and icon and we're all good! Then just had to remove a bug where the image was too large for my Pixel XL (worked fine on the emulator as a Nexus 4)

I then slightly adapted the Connect 3 app that I made in the course and added that. When all is okay, it seems to happen within 30 minutes or so, so pretty quick!

I can see why there are so many sound board apps though, they really are very easy to make. The fart app was almost going to be a 'Ferris Bueller Sound Board', but gathering all the media would have slowed things down somewhat, when the main reason was learning about uploading to the store.

I might do one in the future though :)
 
Soldato
OP
Joined
28 Apr 2011
Posts
14,816
Location
Barnet, London
Thanks. At the moment I'm switching between Tim's Java course and Rob's Android course. I feel I should work through the Java one first but 1) Tim is quite slow and not the best teacher 2) the Android one is allowing me to actually get some apps/projects out there... hence I'm doing bits of both.

I have a couple of basic app ideas, one a copy of one I use now but has stopped being developed and another fairly simple one. Neither are very exciting, but give me a goal of something to work towards. There is no doubt the best way to learn is to do, doing these two apps I was googling how to do all kinds of (fairly simple) things. (Locking an app in portrait, changing theme colours, debugging an error on my Pixel where the image was simply too big)
 
Associate
Joined
1 Dec 2008
Posts
267
Thanks. At the moment I'm switching between Tim's Java course and Rob's Android course. I feel I should work through the Java one first but 1) Tim is quite slow and not the best teacher 2) the Android one is allowing me to actually get some apps/projects out there... hence I'm doing bits of both.

I have a couple of basic app ideas, one a copy of one I use now but has stopped being developed and another fairly simple one. Neither are very exciting, but give me a goal of something to work towards. There is no doubt the best way to learn is to do, doing these two apps I was googling how to do all kinds of (fairly simple) things. (Locking an app in portrait, changing theme colours, debugging an error on my Pixel where the image was simply too big)
Yep, completely agree on the learn by doing front.

On a side note, I see your based in London, there is a very vibrant London android community. They have monthly meetups if you're interested? Always come away with some new technology/library that was presented that I need to try. Highly recommend it, check out meetup.com/android if you want to know more. Shoot me an email if you end up going as I usually try to get to them.
 
Soldato
OP
Joined
28 Apr 2011
Posts
14,816
Location
Barnet, London
So, the first two apps I made I've removed from the Play Store now, but I have three other apps. They're all relatively simple, although the kitchen timer took a good couple of weeks and a lot of hours to get it all working as intended.

https://play.google.com/store/apps/developer?id=AAUK

I'm now working on a Biking App which has a variety of features -

- Add multiple bikes you own
- Weather info and rain alerts*
- Log fuel ups and get various stats per bike (ave MPG, miles this year*)
- Log maintenance jobs with a cost if applicable (again, some stats like how much £££ per bike per year)
- Locations page with Biker hotspots or UK tracks shown on a map, with a favourites page to log your own.
- Emergency button*... for emergencies
- Ride Out page*, track each others location, group chat

* not implemented yet
 
Soldato
OP
Joined
28 Apr 2011
Posts
14,816
Location
Barnet, London
Can anyone help me? I'm trying to parse an xml file located here http://m.highways.gov.uk/feeds/rss/AllEvents.xml

I have code that lets me do it when it's in my res folder (although I think it gave an error about the actual xml) but I can't make it connect and parse the xml via the url above. Can anyone help?

I have a SAXHandler all set up -

Code:
public class SAXHandler extends DefaultHandler{

    private TrafficEvent newTrafficEvent;
    private String content;
    private String latitude;
    private String longitude;

    @Override
    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
        super.startElement(uri, localName, qName, attributes);
        if(qName.equals("title")){
            newTrafficEvent = new TrafficEvent();
        }
    }

    @Override
    public void endElement(String uri, String localName, String qName) throws SAXException {
        switch (qName){
            case "title":
                newTrafficEvent.title = content;
                break;
            case "road":
                newTrafficEvent.road = content;
                break;
            case "category":
                newTrafficEvent.delay = content;
                break;

            case "latitude":
                latitude = content;
                break;
            case "longitude":
                longitude = content;
                newTrafficEvent.location = new LatLng(Double.parseDouble(latitude), Double.parseDouble(longitude));
                break;
            case "description":
                newTrafficEvent.description = content;
                Traffic.trafficEvents.add(newTrafficEvent);
                break;
        }
    }

    @Override
    public void characters(char[] ch, int start, int length) throws SAXException {
        content = String.copyValueOf(ch, start, length).trim();
    }
}
 
Soldato
Joined
5 May 2004
Posts
4,148
Location
Northern Ireland
Can anyone help me? I'm trying to parse an xml file located here http://m.highways.gov.uk/feeds/rss/AllEvents.xml

That's a really cool idea, nice to the the Highways Agency in England providing a good bit of useful information in their RSS feeds. Unfortunately Traffic Watch NI only provide this:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
   <channel>
        <title>Trafficwatch NI Incidents</title>
        <link>http://www.trafficwatchni.com/</link>
        <description>A listing of incidents in Northern Ireland.</description>
        <language>en-gb</language>
        <pubDate>Fri, 19 May 2017 09:54:00 +0000</pubDate>
        <atom:link href="http://rss.trafficwatchni.com/trafficwatchni_incidents_rss.xml" rel="self" type="application/rss+xml" />
        <item>
            <title>Co Down Ballynahinch Rd (Hillsborough - Annahilt) REOPENED, , Ballynahinch Road, Annahilt</title>
            <description><![CDATA[
                .
            ]]></description>
            <pubDate>Fri, 19 May 2017 09:58:14 +0000</pubDate>
            <guid isPermaLink="false">TWNIIncident19055996</guid>
        </item>
    </channel>
</rss>

I wouldn't mind making an app like yours for over here but with so little data there is hardly any point :(
 
Soldato
OP
Joined
28 Apr 2011
Posts
14,816
Location
Barnet, London
I should update. It took most of my day off... but I got it working, in that it downloads it to your device and parses it, deleting and old file. :) I'd like to make it parse it directly at some point, but for now it works.
 
Back
Top Bottom