Posts in the “android” category

How to keep an Android display turned on while your app is running

If you want to make sure that your users’ Android display stays on while your app is running -- such as if you are writing a game/gaming app -- use this call and flag in the onCreate method of your Android Activity:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

Here’s what the Android docs say about the FLAG_KEEP_SCREEN_ON setting:

An Android onTouchEvent method example (View class)

If you need to write an Android onTouchEvent method inside a View class, here’s some example source code (boilerplate/skeleton code) that shows how to implement this method, including how to use the MotionEvent in the method, and how to get the x and y location of the touch event:

How to “pin” a screen in Android 5 (Android screen pinning)

Android FAQ: How do I “pin” a screen in Android?

Pinning a screen in Android requires a setting change. Once you’ve made that change, you can “pin” a screen so it is always shown when you log into your Android device. Here’s how to do it.

Android screen pinning setting

To pin a screen in Android, you first have to go into your settings and make a change. So go to the Settings app, then tap Security. When you scroll down you’ll see a “Screen pinning” setting, as shown here:

How to list your Android devices (AVD and physical devices)

Android FAQ: How do I get a list of Android devices on my computer system (Android AVD devices and physical devices that are currently attached)?

At your command line, just use the adb devices command from the Android SDK:

adb devices

This will list all the names of AVD devices and physical devices currently installed on your computer.

Acer Iconia A100 Android Honeycomb tablet review

Summary of my Acer Iconia A100 tablet review: The Iconia A100 is probably the best tablet available for Android Honeycomb developers at the time of this writing (mid-March, 2012), but I don't recommend it for consumers.

Iconia A100 -The "pros"

Overall, I'd give the Iconia A100 a 7 out of 10 on my scoring scale (I reduced this from an "8" after living with it for a week), so even if I don't write everything I like, there is a lot to like about it:

Android UI design guidelines links

Google has a nice Android UI design guidelines section on the Android website. As I'm working on a new Android tablet application, I keep looking back at this section, and these are the most relevant pages for me:

Acer Iconia A100 - Turning off the blinking home button (light)

Acer Iconia A100 FAQ: How do I turn off the crazy blinking home button/light on the Acer Iconia?

The Iconia home button light blinks when you have a notification you haven't responded to, such as a new email message. To turn off the blinking light, look at the menu bar at the bottom of the screen, and just to the left of the time you'll see an icon indicating that you have some sort of notification. Tap on that icon, delete your notification(s), and the home button will stop blinking.

SQLite drop table syntax (and examples)

SQLite table FAQ: How do I drop a SQLite table? (i.e., "What is the SQLite DROP TABLE syntax?")

SQLite comes with the usual DROP TABLE command, so you can drop a SQLite database table named "orders" like this:

Eclipse Android FAQ: How to set up your Eclipse Android development environment

Eclipse Android FAQ: How to set up the Eclipse Android development environment, including the Eclipse ADT and Android SDK.

After a little digging around I figured out how to install an Eclipse Android development environment, and I thought I'd share my installation notes here. The notes are a little shorter than my usual detailed explanations, but hopefully they're long enough.

To get the Android development environment working with Eclipse, you need to install two components onto your development system:

Android + Eclipse: How to create a new Android Virtual Device (AVD) emulator

Android Eclipse FAQ: How do I create a new Android Virtual Device (AVD) emulator I can use in Eclipse?

There are at least two ways to create a new Android Virtual Device you can use in Eclipse: (a) Using the Eclipse Android GUI, and (b) using the Android command line.

How to create an AVD in Eclipse

Assuming your Android Eclipse work environment is set up properly, creating a new Android Virtual Device (AVD) is simple. Just follow these steps.

Android 6 faster than Android 5?

I’m usually pretty slow to upgrade to new operating systems, as they usually suck the life out of old hardware. But Android 6 really does appear to be faster (and smoother) than Android 5, at least on my Nexus 9 (which I bought in January, 2015).

Android 6 is faster than Android 5.1

Back in January, 2015, I gave myself a Google Nexus 9 as a belated Christmas gift. At that time I liked Android 5.0, but it was a little slow and still a little klunky compared to iOS. Then Google came out with Android 5.1, and it was significantly faster and a little smoother, and I thought, “Hey, this is cool, Google is going in the right direction with this.”

Last week I read that Android 6 was even faster, so I took the jump, and after the upgrade I can confirm that Android 6 is faster than Android 5.1. Not just faster, but even smoother, with better animations/transitions. In a world where most software updates suck the life out of old hardware, this was an awesome upgrade.

(Sorry, I can’t give any stats on how much faster Android 6 is compared to 5.1. I only have one device, and I didn’t think to try to measure the speed before and after the upgrade. All I can say is that I’m much happier with the performance. The only lag times I’ve felt at all in the last week have been with the Chrome browser on certain websites.)

At this point the only major thing I don’t like about Android 6 is selecting text and copying and pasting it. This is still not very smooth, and I hope someone at Google will improve this. To be clear it does work, but I think it can be a lot smoother.

Google might do well to buy Yahoo Finance

Google might do well to buy Yahoo Finance, if just that part is available for sale. I was just using the Yahoo Finance app on my Android Nexus 9 tablet, and for a few moments I forgot that I was using an Android app; it was so smooth I thought I was using an iOS app. The more great apps like that on Android, the better.

Conversely, the Yahoo Mail app on Android is just an average Android app, imho. The 2015 release was much better than earlier versions, but it still has a long ways to go to be a great app.