A better SeekBar for Android

January 27, 2013

Still working on Part 2 of my Android development retrospective but I thought I would put this out here real quick.

One of the smaller pain points in developing for Android was the SeekBar object. The SeekBar is a UI widget object that is roughly analogous to the UISlider in Cocoa Touch.

The UISlider has settable minimum and maximum values (in float) and the slider’s current value is expressed as a float.

The SeekBar for Android always has a minimum of zero and the maximum can be set but only to an int. The current progress is always expressed as an int.

This kind of sucks so I made a class that extends SeekBar and named it BetterSeekBar. You can set minimum and maximum values as float and get the current value as a float as well. Internally, it sets the max to an int of 10,000 and calculates the current value based on floating point offsets and ratios.

You can get the BetterSeekBar.java class right from here (it’s 2KB.) I hope you find it useful!

Advertisements

So long, App-A-Week challenge. Hello, App-A-Month challenge!

July 18, 2012

Hello, dear readers. I have some news.

You haven’t heard much from me lately because I recently (like 3 weeks ago) got a really kick-ass job doing mobile app development with a really cool company. That means I have far less time to work on my own iOS projects.

BUT, I still intend to work on them. What I’ll have to do is modify my original challenge to have a release every month instead of every week.

This months release is the retina-graphics version of Mac Lens•Lab!

Anyway, thanks for reading!


On the Value of Apple Laptops

June 19, 2012

Three years ago at WWDC, Apple announced the unibody 13″ MacBook Pro. I ordered one within hours of the announcement.

I had been using a white MacBook for a few years and I thought it was a great machine. After the aluminum unibody machines came out I started lusting after those designs. I had had experience with 15″ laptops before and I just thought they were too big. I needed FireWire. All of these needs and wants were distilled perfectly in the 13″ unibody MacBook Pro.

I purchased the lowest-end configuration with my wife’s student discount (2GB) and immediately upgraded the RAM to 4GB with memory purchased from NewEgg. Over the years I’ve upgraded the RAM again to 8GB ($35) and added a 80GB Intel SSD (X-25MG2). I just now replaced the old battery (1,052 charge/discharge cycles) myself with a new battery for $66. I’ll be installing Mountain Lion as soon as the golden master is released.

With that new battery, my three year old MacBook Pro is better than it ever was new. It’s totally fast enough for me and the work I do on it (which includes software development and SLR photography.) It has kept its value so well, it is currently worth $850 according to the internet. Subtract that from the total cost of $1450 ($1100 for the laptop, $35 for the RAM, $65 for the battery, $250 for the SSD) and you get $600 is what I have spent on computer technology for the past 3 years. That’s $200 a year.


NSString Concatenation (Category)

June 6, 2012

Hi folks. Just got back from a trip but I thought I would write you and tell you about this thing.

Sometimes, you just want to concatenate a bunch of strings together. There are several ways to do this. You can use stringByAppendingFormat with NSStrings or you can use append with NSMutableStrings. You can also add a bunch of strings to an array and generate a new string based on the array. Some languages overload the “+” operator to allow strings to be added together. Since Objective-C is a strict superset of C we can’t overload that operator.

So, what I’ve done is simply create a category on the NSString class. It contains a single class method called “concatenateStrings” that takes any number of arguments. Any number of NSString or NSMutableString arguments are concatenated together and returned as an NSString.

Get the example project from here.


JSON + iOS 5; GO! (Tutorial)

May 30, 2012

What is JSON? JSON stands for JavaScript Object Notation. It’s a super lightweight and human readable data format. Go check it out and run back here.

iOS 5 includes classes to deal with JSON natively. Which is awesome. Let’s do this!

Twitter has a service that gives you recent tweets in JSON format when you give it a URL. Like this:

https://api.twitter.com/1/statuses/user_timeline.json?screen_name=jmenter&count=10

That’ll give you my 10 most recent tweets in JSON format. Easy peasy. Let’s make an app.

In Xcode, New Project, Single View Application. Use ARC. Coolio.

Add a UITableView to the view. Add it as a property to the ViewController, add the data source and delegate and wire those up.

Add some methods to the ViewController.m: one to issue a request and one to handle it. Fix up the data source and delegate methods.

Done. This was not really a tutorial. Sorry to trick you.

Get the Xcode project here, check out the ViewController.m, and see how easy it is!


A small note on sales.

April 18, 2012

This is just going to be a little post on sales. I hate talking about money and marketing. But it’s sometimes necessary. So here we go.

Item #1: iAds. I added ads to three of my free apps. They are not high traffic apps and don’t have a huge level of engagement. I’ve made maybe $7 in the past three weeks with all these apps. I won’t go into the numbers but I’m just going to conclude that my experiment in seeing if adding ads to my free apps was worth it is a failure. Conclusion #1: adding advertising to low-traffic free apps is totally not worth it.

Item #2: I increased the price of Lens•Lab from Tier 1 to Tier 2 (which means an increase from $.99 to $1.99 for those in the US.) I did this a couple of weeks ago and sales have not been affected one bit. This is great and leads me to conclusion #2: for useful, niche applications, people are not nearly as price sensitive as you might think.

Item #3: My boil addition timer, BrewTime, has been released but sales weren’t as you might say, spectacular. I posted on Reddit’s homebrewing subreddit that I had made a homebrewing app and made a post with a link to the app and 10 promo codes. That day, I ended up giving away 10 copies but I sold more than that. Sales were strong that day and many days following. I tried to not seem too smarmy but I figured that other homebrewers might find the app useful. Conclusion #3: for useful, niche applications, you can instigate small-scale, organic communication with potential customers and not feel like you’re selling your soul and being skeevy.

Anyway, I should probably not call these “conclusions”, more like little things I’m learning along the way. What think?


Hello.

April 10, 2012

You thought I forgot about you. I didn’t. I have apps waiting on approval. I have new apps that are *this* close to being done. I have other app activity. App app app. So, yeah. App.