Integrate Google Analytics SDK to your Android app [Android tutorial]

Introduction Google Analytics now can integrate into your Google Play Developer console and show you statistics how your application is used by your users. It gives you: better insight on how it is perceived by your customers, by showing most recent opened screens and user journeys an overview of how often your app is used … Continue reading Integrate Google Analytics SDK to your Android app [Android tutorial]

Android SearchView tutorial: EditText with phone contacts search and autosuggestion (including source code)

SearchView is available in Android 3.0+. It enables you to search for any data by means of ContentProvider. You can write your custom ContentProvider or use the existing one. For simplicity I will show how to use Android ContactsProvider. The Goal The goal is to buil SearchView to find contact from address book with auto … Continue reading Android SearchView tutorial: EditText with phone contacts search and autosuggestion (including source code)

Android tutorial: Send SMS programatically

SmsManager has a method that is sending SMS message completely without user's interaction needed. If You need to send SMS from your code: 1. Use SmsManager Add these lines to your app import android.telephony.SmsManager; SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage("123456789", null, "sms message", null, null); You can replace these nulls with Intents (according to documentation) that … Continue reading Android tutorial: Send SMS programatically

Source code: Android custom ListView

Since many of you have asked for a source code of this tutorial: Android custom ListView tutorial I decided to write it and share. The tutorial was witten based on a bigger project, so I could not share it. This is why I have written custom ListView source code example from scratch based on the … Continue reading Source code: Android custom ListView

Android BroadcastReceiver tutorial: detect outgoing phone call event

Tutorial shows how to catch outgoing phone call event in Android application (including called phone number information). This basically consists of catching an Intent that is sent by Android OS while call was initiated. So the BroadcastReceiver is required. Steps to build it are as follows: 1. Create OutgoingCallBroadcastReceiver This is a BroadcastReceiver that will … Continue reading Android BroadcastReceiver tutorial: detect outgoing phone call event

Android: change desktop wallpaper programatically

Here is an instruction how to change desktop background on android device rogramatically by means of WallpaperManager. For simplicity the new wallpaper is taken from project resources. private void setDesktopWallpaper() { try { WallpaperManager wallpaperManager = WallpaperManager.getInstance(this); wallpaperManager.setResource(R.drawable.my_wallpaper); } catch (IOException e) { SLog.e(TAG, "Error changing wallpaper: " + e.getMessage()); } } To use another … Continue reading Android: change desktop wallpaper programatically

Android: play default notification sound

When aplication wants to notify user with sound, the best way to do it is to play notification sound that is set by the user on his device. To do it, first you need to get Uri to that audio file from RingtoneManager. After that create a Ringtone object from that Uri and play it: … Continue reading Android: play default notification sound

Android custom button layout tutorial

The goal of this tutorial is to create customized button with your own background. The result will be something like that: There are two ways of creating such background. The common one is to define it in XML file - this way I will describe here. The other, more elastic way is to define it … Continue reading Android custom button layout tutorial