Android PhoneStateListener problem

2010-07-16  来源:本站原创  分类:Mobile  人气:200 

PhoneStateListener general listening for TelephonyManager

private class MyPhoneStateListener extends PhoneStateListener {

                public MyPhoneStateListener() {

                }

                public void onCallStateChanged(int state, String incomingNumber) {
                        switch (state) {
                        case TelephonyManager.CALL_STATE_IDLE:
                                //progress
                                break;
                        case TelephonyManager.CALL_STATE_RINGING:

                                //progress
                                break;
                        default:
                                break;
                        }
                }
        }
TelephonyManager mTelephonyMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

mTelephonyMgr.listen(new MyPhoneStateListener(),PhoneStateListener.LISTEN_CALL_STATE);

This set the problem comes, when the first CALL normal, the second CALL performs the last listen, easy way

mTelephonyMgr.getCallState()

On the line.

相关文章
  • Android PhoneStateListener problem 2010-07-16

    PhoneStateListener general listening for TelephonyManager private class MyPhoneStateListener extends PhoneStateListener { public MyPhoneStateListener() { } public void onCallStateChanged(int state, String incomingNumber) { switch (state) { case Telep

  • Android redraw problem in view 2010-08-23

    Do android redraw problems when, so the Internet and looked, to see the view of a redraw Android an article mentioned in the "keyword: android android realize there are two ways an updated view, a group invalidate, another group is postInvalidate, of

  • Android optimization problem in the ListView 2010-12-05

    Zhuantie! ! I would like to thank those who stand by me on the shoulder of technical predecessors! ! Citie is a direct copy eoe the older "dumb programmers" of the post. Thank you for the first in this, as the purpose is to turn this post becaus

  • A folder failed to be renamed or moved - Android configuration problem 2010-12-23

    1, copy tools directory and paste it into android-sdk-windows renamed the following tools-copy, this time in the android-sdk-windows directory, there are two tools and tools-copy directory 2, in the tools-copy directory, run android.bat, so you can u

  • android screen problem resolution procedures 2011-01-10

    A: Different layout Android phone screen sizes, there are 480x320, 640x360, 800x480. How to make App automatically adapt to different screen it? Is actually very simple, just create a directory in the res folder different layout, such as layout-640x3

  • Go google language abandon java??? Android upper application or language ~ ~ go with Go About Language 2010-09-04

    Summary Go languages is Google's second 2009 release open-source programming language. Go language specifically for multi-processor system application programming optimized, the program can use the Go compile comparable C or C + + code speed, and mor

  • Android View Application 2010-12-03

    Android screen problem Android programming how to express the scale of the screen? For example: android:layout_width="fill_parent" android:layout_height="100px" 100px height in pixels here said, is there another way? How to get access

  • Notes --- Android android security of equipment management 2011-05-23

    Andoid security mechanisms include two levels: the system layer and application layer. Application layer security mechanisms and applications built on the basis of authorization, the paper do not speak. System layer security mechanisms, including the

  • Android Framework (I) Android Spring Json 2011-05-30

    Android Framework (I) Android Spring Json 1. Backgroud of Spring Android and Json First, learn from spring. Spring Mobile project that provides extensions to Spring MVC for developing mobile web apps. Spring Android project that supports the developm

  • android 错误信息大整理 2012-10-23

    android错误信息大整理 大家都在为项目开发成功而喜悦,但可不知成功的路上是会经常出错的,下面是我碰到的一些错误集合! [错误信息] [2011-01-19 16:39:10 - ApiDemos] WARNING: Application does not specify an API level requirement! [2011-01-19 16:39:10 - ApiDemos] Device API version is 8 (Android 2.2) 原因: 不影响正常运行.在

  • Android开发错误信息与解决方案汇总 2012-10-31

    [错误信息] [2011-01-19 16:39:10 - ApiDemos] WARNING: Application does not specify an API level requirement! [2011-01-19 16:39:10 - ApiDemos] Device API version is 8 (Android 2.2) 原因: 不影响正常运行.在AndroidManifest.xml文件中没有加API的版本号,在<manifest> </manifest>

  • Android开发错误汇总 2014-01-04

    大家都在为项目开发成功而喜悦,但可不知成功的路上是会经常出错的,下面是我碰到的一些错误集合! [错误信息] [2011-01-19 16:39:10 - ApiDemos] WARNING: Application does not specify an API level requirement! [2011-01-19 16:39:10 - ApiDemos] Device API version is 8 (Android 2.2) 原因: 不影响正常运行.在AndroidManifest

  • eclipse @ override error solution 2010-06-01

    I think it certainly has troubled many people, I am no exception. The new company will use something more or less different from our previous company. So this problem is often accompanied around us. The first solution: @ Override is JDK5 already ther

  • Share memory using ashmem and binder in the and... 2013-02-20

    To share memory between different processes in the android framework ashmem can be used. Ashmem is a android shared memory addon to the linux kernel. Ashmem has reference counting so that if many processes use the same area the area will not be remov

  • sudo: add-apt-repository: command not found 2014-08-05

    sudo apt-get install python-software-properties http://blog.csdn.net/tonyfield2015/article/details/9729723 ubuntu 12.04 http://www.cnblogs.com/javawebsoa/p/3235315.html http://blog.csdn.net/jianguo_liao19840726/article/details/9774357 http://blog.csd

  • Registration android market app after upload problem 2010-04-03

    Just registered the android market, pay a 25 knife. . . Tips can upload apk page, but the account still being audited, I will upload chanting, how are uploaded can not find the page newspaper JS error. . . An exception, Firefox prompts is less an end

  • android market on the APP that the problem is! 2010-05-03

    I posted in the android market several APP, one of which is free, others are charging! I can see the hero of the market on all of the APP, but the G1, nexus one (temporary measure only this two) can only be seen free of charge but can not see the sof

  • Android's focus (Focus) problem 2010-06-08

    Today resolved a focal point of Android platform. Found that the key problem here is Android's touchMode. People come from JavaSwing platform will focus setFocusable () and requestFocus () method, but Android's View in another way, two months, setFoc

  • android / ophone anyway screen switching solution to the problem 2010-06-11

    Doing or Ophone android development time, by default when the screen changes from vertical to horizontal screen assessment will trigger onConfigurationChanged event by default reload the screen and displays the same screen and Hengping, so there will

  • activity of the android: name referred to in shorthand Activity implementation class problem 2010-06-22

    Outside of work today, found that the company has an Android book, smoothly flipped through, found that the design of Android application framework indeed admiration, simply download the Android own example, the configuration of my environment (set o