1 | import android |
2 | |
3 | droid=android.Android() |
4 | droid.dialogCreateAlert("I like swords.","Do you like swords?") |
5 | droid.dialogSetPositiveButtonText("Yes") |
6 | droid.dialogSetNegativeButtonText("No") |
7 | droid.dialogShow() |
8 | response=droid.dialogGetResponse().result |
9 | droid.dialogDismiss() |
10 | if response.has_key("which"): |
11 | result=response["which"] |
12 | if result=="positive": |
13 | print "Yay! I like swords too!" |
14 | elif result=="negative": |
15 | print "Oh. How sad." |
16 | elif response.has_key("canceled"): # Yes, I know it's mispelled. |
17 | print "You can't even make up your mind?" |
18 | else: |
19 | print "Unknown response=",response |
20 | |
21 | print "Done" |
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
ID | Author/Program | Comment | Date | |
---|---|---|---|---|
937 | #1000604 (pitcher) | 2015-08-20 15:28:24 | ||
936 | #1000610 | Edit suggestion: !636 !629 main { static Object androidContext; static String programID; public static void main(String[] args) throws Exception { 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" }} | 2015-08-20 05:53:44 | delete |
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: | 1016 / 170 |
Referenced in: | [show references] |