Blogs

Just Be, a mindfulness reminder application

Today I’m proud announce that I’ve written an Android application named “Just Be”:

Just Be is a simple but useful “mindfulness reminders” app that helps bring you back to the present moment.

To use Just Be, all you have to do is a) configure the reminders that you want to see, b) optionally add your favorite background images, and c) set a notification schedule, and Just Be will send you notifications (mindfulness reminders) on that schedule.

I’d write more about it here, but I’ve already written about it at JustBe.cc, so please see that website for more information, including a short video.

A Java method to log Android memory use

As a quick note today, here’s a little Java method that I use to log Android memory use from an Activity or Fragment:

private void logMemoryInfo(Context context, String TAG) {
   ActivityManager activityManager = (ActivityManager) context.getSystemService(getActivity().ACTIVITY_SERVICE);
   int memoryClass = activityManager.getMemoryClass();
   ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
   activityManager.getMemoryInfo(memoryInfo);

   Log.i(TAG, "\n------------ RAM -------------");
   Log.i(TAG, "mem class: " + memoryClass);
   Log.i(TAG, "mem avail: " + memoryInfo.availMem);
   Log.i(TAG, "low mem:   " + memoryInfo.lowMemory);
   Log.i(TAG, "threshold: " + memoryInfo.threshold);

   long mb = 1024*1024;
   Runtime runtime = Runtime.getRuntime();
   Log.i(TAG, "Used Memory:  " + (runtime.totalMemory() - runtime.freeMemory()) / mb);
   Log.i(TAG, "Free Memory:  " + runtime.freeMemory()  / mb);
   Log.i(TAG, "Total Memory: " + runtime.totalMemory() / mb);
   Log.i(TAG, "Max Memory:   " + runtime.maxMemory()   / mb);
}

Android AsyncTask - Using "Void, Void, Void" parameters (code signature)

As a quick note to self, this is how I just created an Android AsyncTask with “Void, Void, Void” parameters:

private class DeleteImagesTask extends AsyncTask<Void, Void, Void> {
    @Override
    protected Void doInBackground(Void... params) {
        deleteSelectedGalleryItems();
        return null;
    }
    @Override
    protected void onPostExecute(Void param) {
        cleanupUiAfterCancelOrDelete();
        galleryItemAdapter.notifyDataSetChanged();
    }
}

How to restore an Android emulator to its initial "factory" settings (wipe the data)

To restore an Android emulator to its initial, default settings, you need to find its “image” file on your filesystem and delete it. The image file will be found in your $HOME/.android/avd/<avdname>.avd folder.

For example, I was just working with an AVD named Nexus_6_API_21, and its directory on my Mac OS X system is /Users/al/.android/avd/Nexus_6_API_21.avd. I moved into that directory and found several “.img” files, deleted them, and then restarted the emulator, and it went back to its default settings.

A diary of my first bout with diverticulitis (symptoms, testing, and treatment)

After my first-ever bought with diverticulitis, I wanted to make notes about what happened over the last five days.

Monday, April 7, 2015

On April 7, 2015, I woke up at 3:30am with pain and discomfort in my lower-left abdomen. I knew something was wrong, but I didn’t know what it was. It felt like a golf ball was lodged in there, and several hours later it was still there.

How to make a color transparent in Gimp

I was recently working on some images of a mobile phone, where the mobile phone was surrounded by a solid color that I wanted to make transparent. Unfortunately the phone was black, and that color was dark gray, so when I made the dark gray a transparent color in Gimp using my usual approach -- clicking Colors > Color to Alpha, then choosing dark gray -- it had the effect of bleeding a lot of color out of the black phone. This was wrong.

How to make a rounded rectangle in GIMP

I recently needed to make an icon look like an iOS style app icon -- a rounded rectangle with transparent corners -- and to do that I needed to learn how to create a rounded rectangle in Gimp. This tutorial contains a short step-by-step description of how to do this.

Note: I’m writing this tutorial in April, 2015, using Gimp 2.8.

Syndicate content