(Android) Delay method call
This is how you could delay a method call for a given amount of time. I’ve used this to have an alert dialog pop up a few second after starting an activity. This will fire myMethod() after 3000 miliseconds:
This is how you could delay a method call for a given amount of time. I’ve used this to have an alert dialog pop up a few second after starting an activity. This will fire myMethod() after 3000 miliseconds:
Here’s a quick way to check if Google Play Store is installed. I use this to keep activities that use in-app billing from crashing on devices that doesn’t have Google Play Store. Works fine in the emulator as well. If the method returns false, I’ll just give the user an alert telling them they need… Read More »
This Android emulator is fantastic www.genymotion.com
Here’s one pretty simple way to get your custom view to restore its current state after an orientation change: You can of course put any values in there, for example if you need to restore fields. (quickly plotted code. Haven’t run it, but it should work)
A simple function to convert dp into pixels. Use when you have to pass pixels to a method and want to keep everything to scale. From Android Developer Center : pxPixels – Corresponds to actual pixels on the screen. This unit of measure is not recommended because the actual representation can vary across devices; each… Read More »
Set your number picker to show leading zeros by applying a formatter to it. Example is using an anonymous instance, but of course it doesn’t have to. For %02d this goes: 0 for filling with zeros 2 for length of 2
To prevent a Phonegap-wrapped app from opening external links in the apps webview, use javascript to open the link in the external browser. This works on Android (probably other platforms as well)