【发布时间】:2015-02-24 14:56:47
【问题描述】:
我正在尝试在 android 4.4.3 上使用 qpython 获取来电号码
已经尝试过:
import androidhelper
w=1
while (w == 1):
droid = androidhelper.Android()
droid.startTrackingPhoneState()
phonest = droid.readPhoneState()
number = phonest[2] # If i try to use ['incomingNumber'] not work
if number != None:
droid.makeToast('Call from '+number)
我总是得到 NullPointer 异常
我读到这个: python function call syntax ... result = foo() ['abc'] 但根本不起作用,因为: 这不起作用:
import android
droid = android.Android()
当我尝试这个时:
outerDict = droid.readPhoneState()
innerDict = outerDict['result']
number = innerDict['incomingNumber']
错误,因为需要是整数或类似的东西。
【问题讨论】:
-
回溯会有很大帮助。
-
java.lang.NullPointerexception 无
标签: android python call qpython