get Phone Call State - Android Hardware

Android examples for Hardware:Sim Card

Description

get Phone Call State

Demo Code


//package com.java2s;

import android.content.Context;

import android.telephony.TelephonyManager;

public class Main {

    public static int getCallState(Context context) {
        TelephonyManager tm = ((TelephonyManager) context
                .getSystemService(Context.TELEPHONY_SERVICE));
        return tm.getCallState();
    }//from   w w  w  .j av  a  2 s  . co m
}

Related Tutorials