Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #552 // Android SL4A Python Example

Document

 import android
 
 droid=android.Android()
 droid.dialogCreateAlert("I like swords.","Do you like swords?")
 droid.dialogSetPositiveButtonText("Yes")
 droid.dialogSetNegativeButtonText("No")
 droid.dialogShow()
 response=droid.dialogGetResponse().result
 droid.dialogDismiss()
 if response.has_key("which"):
   result=response["which"]
   if result=="positive":
     print "Yay! I like swords too!"
   elif result=="negative":
     print "Oh. How sad."
 elif response.has_key("canceled"): # Yes, I know it's mispelled.
   print "You can't even make up your mind?"
 else:
   print "Unknown response=",response

 print "Done"

download  show line numbers   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

2 comment(s) hidden. show

Snippet ID: #552
Snippet name: Android SL4A Python Example
Eternal ID of this version: #552/1
Text MD5: 27a35685230800f5c386ede62bbaed6b
Author: stefan
Category:
Type: Document
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-03-27 20:21:30
Source code size: 643 bytes / 21 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 1014 / 170
Referenced in: [show references]