has No Call - Android android.telephony

Android examples for android.telephony:TelephonyManager

Description

has No Call

Demo Code


//package com.java2s;

import android.content.Context;

import android.telephony.TelephonyManager;

public class Main {
    public static boolean hasNoCall(Context context) {
        return getCallState(context) == TelephonyManager.CALL_STATE_IDLE;
    }//from  ww  w  .  ja va2 s.c om

    public static int getCallState(Context context) {
        TelephonyManager tm = ((TelephonyManager) context
                .getSystemService(Context.TELEPHONY_SERVICE));
        return tm.getCallState();
    }
}

Related Tutorials