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!

About these ads

8 Responses to “CSN jautājumi”


  1. 1 Viesturs Proškins (@wieshka) December 14, 2011 at 12:44 pm

    Android market show me that my device in incompatible. Samsung Galaxy Note.

  2. 3 Blakius Ķēmrausis December 14, 2011 at 1:29 pm

    This item cannot be installed in your device’s country.
    Nāksies tomēr doties laimes zemes meklējumos :D

    • 4 cuu508 December 14, 2011 at 1:32 pm

      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.

  3. 5 Andris Sprūds December 14, 2011 at 1:32 pm

    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.

    • 6 cuu508 December 14, 2011 at 1:36 pm

      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.

  4. 7 Andris Sprūds December 14, 2011 at 1:35 pm

    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 currently closed.




Follow

Get every new post delivered to your Inbox.

%d bloggers like this: