Tag: fail

My current list of Android mistakes

As is traditional, I have made silly mistakes while starting a new project – this time, developing an Android app. Here are the biggest ones:

  1. Thinking it wouldn’t be that hard…

    When I finally got USB debugging to work, everything else seemed so easy in comparison. Sure, I’d never programmed for Android before, but it’s well documented… I don’t need to read all of those long, boring-looking guides! I’ll just jump into coding!

  2. … and then running before I could walk

    For my first application, I decided to do something that would mean creating my own custom views and widgets, before I’d even figured-out how the built-in ones worked.

  3. Coding while unwell

    All this, while I had a horrible cold that meant I couldn’t think clearly, and having slept poorly. This is not the best state of mind for debugging things you don’t understand.

Note that none of these are actually specific to Android… I just need to be more patient and read the manual, really!

Not helping this of course, was that the error complained about an invalid cast that didn’t appear in my code, and highlighting a line in the Choreographer class, simply indicating that it happened in a callback. I eventually figured it out:

If you get a complaint about casting between a LayoutParams class and a MarginLayoutParams class, it may well be that you’re using measureChildWithMargins() instead of measureChild().

As another point, when setting colours in hexadecimal, Android uses ARGB. So, while label.setTextColor(0xff0000) will compile fine, you’re giving it an alpha of 0 – fully transparent. To be opaque, it needs to be label.setTextColor(0xffff0000), or something along those lines.

So…

I might reveal what the app will be soon, now that I’m actually making a bit of progress. I’m sort-of hoping to get it on the Android market before the end of October, along the lines of the Ludum Dare October Challenge… though it’s not a game, and I’m not sure if I’ll charge for it. No, I think I will charge. I’ll just have to make sure it works solidly.

Linux Fun!

Given it was a bank holiday weekend, I decided to try reinstalling Linux, having borked it horribly last time, when attempting to install graphics drivers… Yay.

Currently at the stage of installing graphics drivers again… maybe it’ll work, maybe it won’t! Exciting.

I’m running Linux Mint Debian Edition, which needed to update everything immediately after installing, and now has Gnome Shell… which is a bit horrible. Drastically changing a hugely popular desktop system to behave completely differently… perhaps wasn’t the best idea. I reckon they should have branched it to a separate thing, rather than people having to create new projects to keep things the same as they were before.

Aha! It’s installed the drivers now. Time to restart… except Gnome Shell has no clear way to restart. ‘Log out’ didn’t seem correct, so I tried ‘Suspend’ which sounds about right. It seems to rather be some sort of hibernation thing that isn’t working properly, and it’s locked up. (Probably – my silly Revo has no indicator lights, so it’s impossible to tell between extreme business and total idleness. Bah!) Manual override time! (AKA, hold the button until it stops.)

Ah… apparently it’s deaded again. Well, that was that. I’ll get on with attempting to fix things, now.

EDIT:

Hooray! Less than an hour later, and I’ve repaired it!

For future reference: Use sgfxi for installing the correct drivers. It works beautifully!