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:

Games Without Frontiers ~ Peter Gabriel ~ "She's so popular"

Games Without Frontiers, released in 1980, is an interesting song. It begins with words that sound like, “She’s so popular,” but songfacts states that those words are actually, “Jeux Sans Frontières,” which is French for “Games Without Frontiers.” This information comes from Wikipedia: “The song’s title refers to Jeux Sans Frontières, a long-running TV show broadcast in several European countries, in which teams of residents representing a town in one of the participating countries would compete in games of skill while frequently dressed in bizarre costumes. The British version was titled It’s a Knockout, which Gabriel references in the lyrics. The lyrics themselves are an allegory of the childish antics of adults.”

Here’s the video on YouTube:

Android/Java: How to get your app's root data directory

If you ever need to get the root data directory of your Android application (app) from within your Java code, I can confirm that this approach works:

File rootDataDir = getActivity().getFilesDir();

When I log that directory like this:

Log.i(TAG, rootDataDir.toString());

it prints this output for my application:

/data/data/com.alvinalexander.mynewapp/files

where com.alvinalexander.mynewapp is the package name for my new Android app.

Syndicate content