image

Monodraw, an ASCII art drawing app for Max OS X alvin March 5, 2016 - 11:56am

This weekend I’ll be giving Monodraw a test drive. It’s an ASCII-art drawing program for Mac OS X. If it’s as good as advertised I may use it to draw images for my new book.

Subaru marketing and branding

I’ve become a fan of Subaru’s marketing/branding since buying my car last year. Unlike other auto makers who seem to be like, “Hey, you bought one of our cars, good luck with that,” Subaru comes right at you and says, “Hey, Al, you’re one of the Subaru family now. Here are some nice initial discounts on accessories and service, your first oil change is on us, and we’re going to stay in touch with you through our ‘drive’ magazine about what other people are doing with their Subarus, great trips to take, and oh yeah, some new car stuff as well.” They also send some mailers on a consistent basis to remind you that you own a Subaru. I’m not expressing it well, but they do a good job of welcoming you to the family — whether you think you want to be in that family, or not.

Android: Getting references to Drawable images

As two quick Android “drawable” notes, if you want to convert a drawable resource into a Drawable reference, you can use code like this:

Drawable myImage = getResources().getDrawable(R.drawable.myImage);

Second, if you want to display a drawable image resource on an ImageView, you can use code like this:

imageView.setImageResource(R.drawable.myImage);

(I share little code snippets out here like this because I can never remember how to do some of these things.)

What I learned today, February 23, 2015 (mostly Android)

This is a collection of notes about what I learned today, February 23, 2015. Most of it is about Android.

I need to refresh my cursor data set before calling notifyDataSetChanged

When (a) adding, editing, or deleting items in a ListView and (b) using a CursorAdapter, I need to update my cursor object before calling notifyDataSetChanged. I created this method, which I call from my fragment’s onResume method:

Android: How to load an image from a file and set on an ImageView

If you’re working with an Android application, this source code seems to work to load an image from a file:

Bitmap bitmap = BitmapFactory.decodeFile(pathToPicture);

The Bitmap and BitmapFactory classes are located in the android.graphics package:

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

Assuming that your pathToPicture is correct, you can then add this bitmap image to an ImageView like this:

How to put a background image behind a translucent/opaque TextView in Android

I just had an unusual Android need: I wanted to put an image behind a TextView, where the TextView was occupying the fullscreen. But, I didn’t want the image to be completely visible, I wanted the TextView to be mostly opaque so that you would only get a hint of the image. You can think of this as wanting a watermark image behind a large text editing area.

Jumping right to the solution, this Android XML layout code gave me the solution: