2011-10-11

FAB call list

Here is a short SL4A Python script to pop up a list of names.  Clicking a name will call the number directly.

I use this script to keep track of the FAB numbers registered with my mobile carrier that I can call free of charge.  The best thing is that I can edit those numbers directly on my phone!


# fabcall.py

fab = [
     'My Friend #1: 111-111-1111',
     'My Friend #2: 222-222-222',
     'My Friend #3: 333-333-3333',
]

droid = android.Android()

if __name__ == '__main__':
    title = 'FAB'
    droid.dialogCreateAlert(title)
    droid.dialogSetItems([x.split(':')[0].strip() for x in fab])
    droid.dialogShow()
    result = droid.dialogGetResponse().result
    if result.has_key('item'):
        index = result['item']
        name, tel = fab[index].split(':')
        droid.makeToast('Dialing ' + name.strip())
        droid.phoneCallNumber(tel.strip())


No comments: