Android Call Log change notification example

Learnt about How to read call logs in Android phone, this tutorial will tell how to listen to Android call log changes in  phone. If any call log entry is added, deleted or updated, then fire a notification event. Here are the simple steps. 1) Create a class to receive the call log change events public class …

Read call Logs in Android example

Read call logs in Android here are the simple steps. 1) Update Manifest file with following permissions. <uses-permission android:name=”android.permission.READ_CALL_LOG”/> <uses-permission android:name=”android.permission.WRITE_CALL_LOG”/> <uses-permission android:name=”android.permission.READ_CONTACTS” /> <uses-permission android:name=”android.permission.WRITE_CONTACTS”/> 2) Use CallLog.Calls.CONTENT_URI to read call logs & traverse the cursor. //Fetches the complete call log in descending order. i.e recent calls appears first. Cursor c = getApplicationContext().getContentResolver().query(CallLog.Calls.CONTENT_URI, projection, null, …

Android custom action bar with different styles example

Android action bar by default comes with dark or Light theme, programmatically  styles can be changed by modifying styles.xml of values folder. Note: We are using v7 appcompat support library, it support action bar in all the devices from API 7 onward. To get Dark action bar in all the version of devices, just go to styles.xml in all folder …

How to show listview in Android alertdialog

To Show simple Listview in Alertdialog, just create List of strings & then pass it to alert dialog object. Here is the sample example shows alertdialog with list of animals. public void ShowAlertDialogWithListview() { List<String> mAnimals = new ArrayList<String>(); mAnimals.add(“Cat”); mAnimals.add(“Dog”); mAnimals.add(“Horse”); mAnimals.add(“Elephant”); mAnimals.add(“Rat”); mAnimals.add(“Lion”); //Create sequence of items final CharSequence[] Animals = mAnimals.toArray(new String[mAnimals.size()]); …

How to display custom dialog on Android home screen

To show custom dialog on Android home screen we need to have 3 different components in the application. 1) Alarm manager to trigger alarm. 2) Receiver for receiving the alarm. 3) Custom Activity Dialog. In our example on click of button you need to wait for 1 minutes. By that time quit the app and …

Android action bar tabs swipe views

Hello, in this tutorial we will see how to create tabs in Android with swipe feature. We use latest v7 appcompat library which provides support from devices API 8 onwards. First create a simple project called, androidtabsexample. Create activity with viewpager, this is required to hold tab views. these are nothing but fragments. Here we …

programmatically check android phone connected to internet

To detect Android phone is connected to internet or not programmatically use the following sample code. To identify the mobile network state, use ConnectivityManager class, first get the object and identify the state i.e is it Mobile data (2G/3G) or Wifi broadband internet.Check the connectivitymanager object is returning NULL or not, i have seen in few of …