background preloader

Android

Facebook Twitter

Show PDF in Android. Android - ACTION_SENDTO for sending an email. Android Shapes – Example. How to make custom indeterminate ProgressBar in Android or how to change ProgressBar style or color « Igor Khrupin. Android builds: dev & prod. The release checklist I've been working with Android a lot lately, and something I hadn't quite figured out was configuration management for different environments.

Android builds: dev & prod

Well until yesterday, so I thought I'd blog about it! The official checklist for publishing an app to the market unfortunately shows a very waterfall approach. While it gives crucial info about what you need to do, it also includes scary headings such as Before you do the final compile! For the sake of everyone including our users, I hope we're all doing incremental releases. So let's have a look at the minimal list of what differs between a dev build and a prod release. Both Eclipse and IntelliJ now have good Android plugins, and technically you can publish your app with a click of a button. Can build either version with the appropriate config valuesDoes not require a lot of code duplicationCan still press "run" in the IDE to get a debug version running A quick online search revealed a few different approaches: Runtime config. Back and other hard keys: three stories. Android 2.0 introduces new behavior and support for handling hard keys such as BACK and MENU, including some special features to support the virtual hard keys that are appearing on recent devices such as Droid.

Back and other hard keys: three stories

This article will give you three stories on these changes: from the most simple to the gory details. Pick the one you prefer. Story 1: Making things easier for developers If you were to survey the base applications in the Android platform, you would notice a fairly common pattern: add a little bit of magic to intercept the BACK key and do something different. To do this right, the magic needs to look something like this: @Overridepublic boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { // do something on back. return true; } return super.onKeyDown(keyCode, event);} @Overridepublic void onBackPressed() {// do something on back.return;}

Android – ItemizedOverlay + ArrayIndexOutOfBoundsException / NullPointerException workarounds « Developmentality. Home > Android, Java, programming > Android – ItemizedOverlay + ArrayIndexOutOfBoundsException / NullPointerException workarounds There’s some gotchas to be aware of when using the ItemizedOverlay class Google provides.

Android – ItemizedOverlay + ArrayIndexOutOfBoundsException / NullPointerException workarounds « Developmentality

Here’s the situation (a fairly common one): You have a dynamic list of Icons you wish to display on a map. The list can grow and shrink. You might think the following would work: Seems like a reasonable assumption, doesn’t it? You’re not out of the woods yet, though. The source is closed, so you have no idea what is throwing the ArrayIndexOutOfBounds; it’s in code you didn’t write. The skeleton now looks like the following: Hopefully this pops up in Google and saves some people some trouble.

Android RemoteExceptions and Services. Coding style - How to add multiple theme attributes to the same activity on Android Manifest. Android disable image button UI feel. Android Button background image pressed/highlighted and disabled states without using multiple images. In Android, if you provide custom background images for buttons, you will lose the pressed and disabled image effects.

Android Button background image pressed/highlighted and disabled states without using multiple images

The common way to fix that is to provide additional images for those states. I’m lazy and I find this inconvenient especially during the prototyping phase of app development. Android RelativeLayout example. In Android, RelativeLayout let you position your component base on the nearby (relative or sibling) component’s position.

Android RelativeLayout example

It’s the most flexible layout, that allow you to position your component to display in anywhere you want (if you know how to “relative” it). In RelativeLayout, you can use “above, below, left and right” to arrange the component position, for example, display a “button1″ below “button2″, or display “button3″ on right of the “button1″. Note The RelativeLayout is very flexible, but hard to master it. Suggest you use Eclipse IDE to drag the component, then view study the Eclipse generated XML layout code to understand how to code “relative” components. In this tutorial, we show you how to arrange / position button, textview and editbox via “RelativeLayout“. P.S This project is developed in Eclipse 3.7, and tested with Android 2.3.3. Testing Fundamentals. The Android testing framework, an integral part of the development environment, provides an architecture and powerful tools that help you test every aspect of your application at every level from unit to framework.

Testing Fundamentals

The testing framework has these key features: Android JUnit Test Example. Android ships with JUnit built in.

Android JUnit Test Example

But it's not the easiest to understand how to use it. AndroidManifest.xml Make sure you have specify that your application is using the junit libraries and remember to define the instrumentation. AllTests.java This is what kicks-start all the other tests. Package com.example.app; Google maps api for android, getting SHA1 cert instead of MD5. Think Android.