Ever used a
FragmentStatePagerAdapter? We’re using one at work for our ticket purchasing wizard. The user enters the wizard, and can progress to the next page once they’ve completed the current one. We control this by manipulating the stack of pages and notifying the adapter that the data has changed when a new page is available.
Unfortunately, when changing pages that have already been loaded, there’s an unexpected bug. Specifically, when you load a page, remove it and then insert a new one in its place, the next time the fragment at that index is loaded, it receives the
savedInstanceState bundle for the old fragment.
Broke my Github streak this week, at 31 days - in fact, I didn’t get any programming done this week. My partner and I left Auckland on Wednesday afternoon and didn’t arrive home until late Sunday evening. We travelled around the Coromandel peninsula and spent time climbing mountains, visiting beaches, doing touristy things - and we got engaged! I’d say that that’s a pretty good excuse for missing a week.
Last week I wrote a Sudoku solver script in Python. That was fun and all, but as my girlfriend pointed out - it’s not really usable for, er, well, most people. So this week I decided to make it a bit more versatile and build it into a service, with a website to go with it. It’s currently up on Github and once I’ve added some polish to the website (heh, it’s pretty awful right now) I’ll get it up on App Engine.Read on →
This week I finally got around to doing something I’ve wanted to do for a while; I wrote a Sudoku Solver in Python.
Unfortunately, it doesn’t work. At all. In fact, the more I look into it, the worse I fear it is. I’ve attempted this before, but I struck a minor obstacle with some Python syntax and did something else instead; this time, I’ve got the entire algorithm worked out and developed. There’s just some fairly significant logic bug(s) that’re causing problems. Re-reading the code, there’s also quite a bit of that which could do with a rewrite.
No matter! I’m pretty happy I got the majority of the work done, and I’ll keep working on it - a bit of refactoring should hopefully make the logical errors a bit more obvious.
Edit (Jan 21 2014): Fixed.
I checked in some code every day this week. That being said, I don’t really have a ‘Thing’ that I’ve done. Turns out that I’m running out of ideas for small, week-long projects. My plan to do some small things and even a bigger project over my 2 week break didn’t work out so well - Christmas takes up a lot of time, and there was plenty of other things to do in my time off, too.
So while I haven’t done any one thing worthy of note, some of the stuff I have done (these are mostly quite trivial):
- Implemented PullToRefresh library
- Implemented the Crouton library for toasts
- Decided that loading 1000+ items with ORMLite to back a
ListViewwas not a good idea and actually got around to writing the plumbing code to use a
- Added a check for ‘last checked date’ so we now query for the smallest number of quakes
You may have noticed (heh, who am I kidding - no one is sitting around waiting for these captivating posts) that I missed week 13 of my 20 Things, 20 Weeks project. I could make excuses about it being Christmas, and being super busy, but that’d be a lie. I was probably playing Hearthstone.Read on →
Actually managed to get some code written this week, though it’s still pretty rough - I’ve got a basic widget working for What’s Shaking, NZ? for Android. Exciting stuff; that’ll be polished up and good to go next week. It was actually really easy to do, as I can update it directly from my existing background service (which polls the NZ Geonet API).
Also wrote a blog post on a common Java encoding issue - basically, when you’ve got a UTF-8 file with a Byte Order Mark at the start, things that parse that can freak out if they’re not expecting it. Easiest way to avoid it is to get rid of the BOM altogether.