CSN jautājumi

Back in spring-summer when I was studying for motorcycle licence, I put together an app to try exam questions with. It was super-simple, and took about one-two days worh of work. Python script scraped exam questions and illustrations from the official, HTML-driven test site and packaged them up neatly in SQLite database. The database (about 3MB) would be distributed with the app. The most interesting aspect was that pictures were encoded in WebP format to get the APK size down. Android doesn’t have built-in support for WebP until ICS, so I had to get my hands dirty with NDK and JNI.

So that was that. A really bare-bones app, but a fun weekend project. Now I’ve got another fun weekend project to share! The same idea and codebase fixed up to look better, and work better! Here it is on Android Market.

The notable changes:

  • I’m still no artist/designer, but I think this one looks a bit better than the previous version
  • I’m using newer version of libwebp, and the JNI bindings that are supplied with it. Byte array to Bitmap conversion in Java land is a bit more efficient too. Details here
  • Move through question “cards” with swipes. I’m using ViewPager for this and I have to admit I’ve had a pleasant experience with it. Each question screen is a self-contained fragment. I wrote adapter that instantiates the fragments, and ViewPager takes care of the rest–creating new fragments when they are about to become visible, destroying fragments when they move further off-screen
  • Encoded WebP pictures are not in SQLite database any more but in separate file now. The reason is this: A SQLite database bundled with the app (in /assets/ or in /res/raw) cannot be used, even if read-only, from these locations. It first has to be copied to internal or external storage. By storing pictures separately, I can keep the database size low (200KB or so), and waste less space with the duplicate copy

Cool stuff, in other news my car has engine knock. Android development is enjoyable once you learn the ropes, but now when I think about it, it would be so so insanely cool if I had the necessary expertise to work on engines of motor vehicles. Yeah, well THAT would be something!


8 thoughts on “CSN jautājumi

    1. Huhuh. Pie atļautajām valstīm biju ieķeksējis LV, UK un IE lai nesārņotu citās valstīs. Laikam tomēr nebija laba doma–pēc brīža būs pieejamams visās valstīs.

  1. I downloaded the app but initially was unable to figure out how to move to the next question. Flipping through questions is cool, but you might want to consider adding an welcome screen where this is explained. Otherwise – good work, and indeed, this version seems to have much nicer user interface compared to the previous app.

    1. About the welcome screen–good idea!
      I actually was prototyping one, but couldn’t get it to look good, and wanted something out of the door ASAP–so this version had to do without.
      I’ll keep this in mind for next version.

  2. Regarding those previous comments on Device country – it seems that you have enabled Latvia only in Market settings (Under “Supported Devices”). This does not work out so well for Bite users as they are reported as coming from Lithuania.

Comments are closed.