Tuesday, June 23, 2009

How to Change Your Spinner Typeface

Pretty much every widget in Android that contains text has a setTypeface method...except for Spinners. I looked around in vain for an example or tutorial that would demonstrate how to set the typeface for text in a spinner, so I asked for help in a couple of forums. Mark Murphy replied with a proposed solution, and Philip helped explain the answer to me, so for anyone who needs to do this in an Android app and doesn't know how, hope this helps.

First, create a new XML file in your res/layout directory called "my_spinner_style.xml", and put in something like the following content:

android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="9pt"
android:singleLine="True"
android:id="@+id/spinnerTarget"
android:textColor="#000000"
android:gravity="center"/>
Then in your code, use something like this:

Spinner mySpinner = (Spinner) findViewById(R.id.my_spinner);
mySpinnerArrayAdapter = new MyCustomArrayAdapter(this, R.layout.my_spinner_style); mySpinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Normally you would create a new ArrayAdapter for the second line, but in this case you need to create a custom ArrayAdapter and override the methods that get the TextView from our custom spinner style.

So, you need to put in the code for your custom ArrayAdapter, like so:
private class MyArrayAdapter extends ArrayAdapter {

public MyArrayAdapter(Context context, int textViewResourceId) {
super(context, textViewResourceId);
}

public TextView getView(int position, View convertView, ViewGroup parent) {
TextView v = (TextView) super.getView(position, convertView, parent);
v.setTypeface(myFont);
return v;
}

public TextView getDropDownView(int position, View convertView, ViewGroup parent) {
TextView v = (TextView) super.getView(position, convertView, parent);
v.setTypeface(myFont);
return v;
}

}
The font you want to use needs to reside in the assets/fonts directory, and you access it like so:
Typeface myFont = Typeface.createFromAsset(getAssets(), "fonts/myfont.ttf");
And that's pretty much it. I always appreciate it when I'm having a problem and I Google around and find in someone's blog that they've already dealt with the same issue, so I hope this helps someone.

Friday, June 19, 2009

Golf Solitaire Free Marches Up and Onward

According to AndroidStats, as of this writing, Golf Solitaire Free is #15 in the Cards and Casino category, having moved up very quickly through the rankings.

This is thankfully also resulting in a decent amount of conversions to the paid version. Spades Free has slid down to #6, but that's reasonable, considering I haven't done any updates since near release.

I'd like to at least keep a decent trickle of revenue coming in over the summer as I work on my game for the second Android Developer Challenge.

Saturday, June 13, 2009

My First 80-something Days in the Android Market

So I've been selling and releasing ad-supported apps on the Android market now for nearly 3 months. It's difficult to gauge success. I thought I wasn't really doing all that well, but it sounds like relative to all but the outliers in the iPhone market I'm doing pretty well. This iPhone developer is complaining about having a couple of apps in the top 100 in their respective category and still only pulling in about $20/day.

So here are some summary stats for reference.
  • I released my first paid app, ConcretePal, 83 days ago.
  • My average daily net income for that span is: $19.41
  • My average daily income from ads for that span is: $8.74
    I've released 22 total apps: 14 paid and 8 free (6 of those are ad-supported demo versions of paid apps)
Here's a visual breakdown:

I thought I was going to do very well in the market when I released Spades for $2.99, it was the only one on the market, and it sold very well. But as you can see, that didn't last too long. Sales for a given app settle down to a pretty low baseline, so you constantly need to be releasing new apps if you want to keep the revenue stream coming.

So, I'm not getting rich, but it's nice supplemental income. And it sounds like it's comparable to iPhone apps that are doing reasonably well.

I hope the sales do stay up all right over the next couple of months. I'm not going to be able to release any new apps, since I'm working full-time on my game for the Android Developer Challenge II. It's coming along pretty well. I just hope I can get a decent working version ready for submission by August.

Soon I'll post some screen shots and concept art to give you an idea of where it's headed.

Friday, June 12, 2009

Welcome!

I've started this blog to provide a place to keep up-to-date with stuff going on at Polyclef Software. I started this company with an interest in making downloadable PC games, but my attention shifted to the new mobile platform Android when a friend introduced me to it.

I'll talk about writing games, apps, and my experiences with free and paid versions of software. I'll also post about planned and upcoming software.

Thanks for stopping by.