Scala, Java, Unix, MacOS tutorials (page 246)

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:

If you attempt to do a normal git push origin master after adding a tag, you’ll get an “Everything up-to-date” message from Git. In short, this is because you have to push a tag to the origin just like you push a branch.

In my case I just created a tag named v0.1, so I pushed it like this:

git push origin v0.1

The output from the git push command looks like this:

“Steve (Jobs) was the most focused person I’ve met in my life. It’s terrifying that when you really, truly focus, it seems a bit illegal. You can achieve so much.”

This is a photo from the KTUU Channel 2 News Facebook page in Anchorage, Alaska. It’s accompanied by this comment: “An aerial photo of Anchorage as I was preparing to land last night (19 Feb) at Lake Hood. Note the Star on the mountain behind the city!” -- Dave Oberg, Regal Air Service.

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:

Here are a few notes on using static fields in Android, from this SO page. (Note: Some of the stuff on that page is very wrong.)

Because static fields live until an Android app is killed (while instance fields are destroyed a lot), I’ve been using static fields to persist some of my Android app’s “state” data, but I was just thinking that I can probably do the same thing at the Activity level using onSaveInstanceState(Bundle) and then restoring the state with onCreate(Bundle) and onRestoreInstanceState(Bundle). The correct approach really depends on the problem you’re trying to solve.

This image is part of a Fast Company article titled, Why Samsung Design Stinks. It also mentions “Steve Jobs Syndrome.” The thing I like about this text is that it makes a great counterpoint to something I posted yesterday about how designers need to focus on delivering products.

Notes on how to sit in meditation, by Thich Nhat Hanh, from LionsRoar.com.

I was working with Android Preferences recently, and after writing a few “save my preference” methods, I decided to take a few minutes to organize my code and put all of those Preference methods in a PreferenceUtils class. I made the methods static, and following functional programming principles, I made their output depend only on their input, so they require you to pass in a Context reference, along with your preference key and value.

A friend sent me these comments by Steve Wozniak on the Apple Watch. He makes the point I’ve been saying for a long time: I haven’t worn a watch in about 20 years, will this technology be enough to make me want to wear one again?

As another quick Android example, this Java source code shows how to add a “click listener” (on click/tap event) to an Android Button:

To set an image on an Android ImageButton, you basically just need to put your image in the “res/drawable” directories, and then add this tag to your ImageButton XML definition:

android:src="@drawable/my_image"

That assumes the image file is named my_image.png.

Here’s a full ImageButton example to demonstrate this:

The snowy view from my office today.

This is a good article on how to run a successful Kickstarter campaign. (Note: It also helps if you have a product people want.)