Prevent Touch Panning and Zooming on Mobile Web Pages with CSS touch-action Property

The new touch-action property from the CSS Pointer Events spec can help us (as developers) specify what sort of manipulation (panning, zooming, etc.) should be allowed by a user in a particular region (one or more DOM elements) in a specific web page on a mobile device. It helps specify the sort of interactions or gestures allowed by the user in one or both axis.

Continue reading “Prevent Touch Panning and Zooming on Mobile Web Pages with CSS touch-action Property”

Android Pick/Select Image from Gallery with Intents

Sometimes in your Android application you’ll want the user to choose an image from the gallery that’ll be displayed by the application (and even uploaded to your servers) after the selection is made. In this article we’ll see how to invoke a single interface from which the user is able to select images across all his apps (like Gallery, Photos, ES File Explorer, etc.) and folders (Google Drive, Recent, Downloads, etc.) using Intents.

Continue reading “Android Pick/Select Image from Gallery with Intents”

Google Place API Autocomplete Service in Android Application

Recently in one of my android applications I wanted to obtain the user’s location in terms of city and country that they can feed from their (edit) profile section. So one way to do this is basically have two dropdowns or dialogs (or even open an entirely new activity where the user can search through entities and select one). One of them would display all the countries in which, once a selection is made, the other one will show a restricted set of cities based on the prior country selection. Now the number of cities in the world is large, so to do this we’ll need to get a database that contains all the countries and cities and then make sure we can query that over HTTP to get the cities based on what the user types into the app (autocomplete box). We’ve to make sure the response is really quick and doesn’t cause lags. We can also bundle all the city and country data into our app but then that’ll blow up the apk size.

Continue reading “Google Place API Autocomplete Service in Android Application”

Android Send and Receive SMS (Text and Data/Binary) Messages with SmsManager and Intents

There’ll be times when you’ll want to allow the users to send SMS messages directly from your app to other numbers (destination). The Android SDK does support to capability of sending SMS/MMS messages in two ways (from your app):

Continue reading “Android Send and Receive SMS (Text and Data/Binary) Messages with SmsManager and Intents”

Creating Android Sliding Sidebar (Hamburger) Menu with Navigation Drawer Icon

By now most of us are familiar with Navigation Drawers as they’ve been in use by Facebook, Gmail, Google Play Music, Google Play Music and tons of others apps. It’s that sliding panel that comes out onto the screen when you swipe a finger from the left edge of the screen (or sometimes right edge) or tap on the 3 bar button (sometimes called hamburger icon) in the Action Bar. If still confused then check out the design guide and you’ll know what I’m referring to. The design guide will also tell you when to use it and when not to use it.

Continue reading “Creating Android Sliding Sidebar (Hamburger) Menu with Navigation Drawer Icon”

Difference Between setDisplayHomeAsUpEnabled(), setHomeButtonEnabled() and setDisplayShowHomeEnabled() ActionBar Methods in Android

The Android ActionBar has a couple of methods that can get a little confusing at times as to what their purpose is:

Continue reading “Difference Between setDisplayHomeAsUpEnabled(), setHomeButtonEnabled() and setDisplayShowHomeEnabled() ActionBar Methods in Android”

Android Themes, Styles and Attributes

One thing that bugs me from time to time is the appearance and disappearance of the Action bar or the change in its UI with similar XML code and Java API calls but with different themes. I was somehow managing till now but then decided that it’s probably a good time to understand the concept of themes and styles in android to make sure I know why there’s that frustrating difference just by a small change in the theme name (res/values/styles.xml then used in AndroidManifest.xml) that you sometimes do not even realize while creating new projects as it is set automatically based on the API levels you target.

Continue reading “Android Themes, Styles and Attributes”