A Simple Tip for developers writing both Kotlin & Swift

In your day to day programming, do you jump back and forth between writing Kotlin and Swift code as I do? You’ve also probably noticed that you develop muscle memory as you type the keywords. The two languages are quite similar and this lets me be quite productive in both. Yet, there is one set of keywords in particular that gets me every time: Kotlin’s val vs Swift’s let. I often end up typing let for Kotlin code, or val for Swift code.

Continue reading “A Simple Tip for developers writing both Kotlin & Swift”

‘lateinit’ modifier is not allowed on properties of a type with nullable

I was developing an abstract & generic base class where the generic parameter defines the type of an abstract field. This field would be initialized by inherited classes, so I applied the 'lateinit' modifier to it which caused an interesting error: 'lateinit' modifier is not allowed on properties of a type with nullable 

Continue reading “‘lateinit’ modifier is not allowed on properties of a type with nullable”

Tracking install sources for Android apps

Have you ever wanted to have a better idea of what’s the best source of your app installs? There’s information around the web on how to do it, but spread out over various sites, so I decided to write this post to consolidate the information.

Starting with Android 1.6, the Android Market’s emits a broadcast Intent named com.android.vending.INSTALL_REFERRER whenever certain parameters are added to the market url. Note that web version of the Market also passes these parameters to your devices upon install. Since the parameters need to follow the Google Analytics referral link format, Google provides a simple tool for generating these urls, or you could use a copy of my shared Google spreadsheet that I use to keep track of all my campaigns. Here’s a description for the important parameters:

Continue reading “Tracking install sources for Android apps”

“Incorrect AVA format” when creating a signing key

incorrectAVA

Have you ever run into the error “Incorrect AVA format” when trying to sign an Android APK with a new key? It turns out this useless error more than likely means that you have used some illegal character in the signing data. In my case, I had used a comma in the company name which isn’t allowed for some reason. Just remove any extra characters and you should be good to go!

EDIT: Great comment below from Adam M Dutko:

Put a \ before the commas and it will work. Here is an example: OU=Test Company\, LLC

Adding formatted HTML text to your Android app

HelpTextRender

To help make our Android applications look even more professional, we can include HTML formatted text and display it in a WebView. Here’s the simplest way I’ve found to have local HTML, image and style files and display them. This is the same process I use to display help in Grandma Jong.

First, I’ve stored all my files in a subfolder of assets. This will make it easier to load the HTML, and via some built-in functionality in Android, it will load all assets from the same folder as well. Here’s a screenshot of the assets folder:

Continue reading “Adding formatted HTML text to your Android app”

Back on track

tracksFlickr photo by _fLeMmA_

It has been a long couple of months from before Thanksgiving straight through Christmas and New Years and I was very busy during those times. I didn’t get a whole lot done on anything Android related, including working much on my first app to be published to the Android Market, titled Grandma Jong.

Continue reading “Back on track”

Presenting tomorrow at BarCamp DC 3

Barcamp DC photo by jgarberI’m really excited about attending the third local BarCamp in DC tomorrow! Yep, we’re already on our third one here locally (not to mention all the others happening in the Baltimore-Washington D.C. area). I’m planning on co-presenting on Android development with Zvi Band. I’ll be showing a simple graphical app with animation and touch screen input.

I’m also using this opportunity to launch the first in a series of articles on Android development, gradually improving this simple app into something useable in a real app involving animations and graphics. Stay tuned, I’ll be posting the first article here sometime next week.

Android WVGA Support

I came across this interesting discussion yesterday regarding WVGA supporting coming in the Donut (1.6) version of Android OS. It looks like there will be a lot of work cut out for developers because we’ll need to support Cupcake (1.5) which is standardized on HVGA, and Donut which will now start supporting not only various resolutions, but also various screen densities. As developers, we’ll need to consider our layouts on various screens to make sure the look their best. Thankfully, there will be some built-in support for scaling layouts and images to ease the transition.

There is a blog post being written on the topic of different screen sizes, and we have gone through round after round of work on the underlying model of the platform and how to best explain the way this works, which is reflected in the doc.

As a side note, Al Sutton of AndAppStore.com has prepared a build of the 1.6 SDK and eclipse plugin to help test out the features coming in the next revision. We’ll need all the head start we can get to implement these new features. I’ve played around with this a bit, and like some of the new features coming to the eclipse plugin. I’ll write more about these later.