GetInput
BeanShell
source("/sdcard/com.googlecode.bshforandroid/extras/bsh/android.bsh");
droid = Android();
droid.call("dialogGetInput","dialogGetInput","using BeanShell");
response = droid.call("dialogGetResponse");
result = response.get("result");
if (result.get("which").equals("positive")) {
droid.call("notify","dialogGetInput using BeanShell",result.get("value"));
} else {
droid.call("makeToast","dialogGetInput using BeanShell:"+result.get("which"));
}
Bex
include("/sdcard/com.googlecode.bexforandroid/extras/bex/android.bex")
droid = Android()
droid.call("dialogGetInput","dialogGetInput","using Bex")
response = droid.call("dialogGetResponse")
result = response.get("result")
if (result.get("which").equals("positive")) {
droid.call("notify","dialogGetInput using Bex",result.get("value"))
} {
droid.call("makeToast","dialogGetInput using Bex:"+result.get("which"))
}
Erlang
-module(getInput_Erlang).
-export([main/0]).
main()->
android:dialogGetInput("dialogGetInput","using Erlang"),
Response = android:dialogGetResponse(),
{ struct,[{"value",Value},{"which",Result}]} = Response,
if
Result == "positive" ->
android:notify("dialogGetInput using Erlang",Value);
true ->
android:makeToast(string:concat("dialogGetInput using Erlang:",Result))
end.
Html and JavaScript
<HTML><HEAD><SCRIPT>
var droid = new Android();
droid.dialogGetInput("dialogGetInput","using HTML and JavaScript");
var result = droid.dialogGetResponse().result;
if (result.which == "positive") {
droid.notify("dialogGetInput using HTML and JavaScript",result.value);
} else {
droid.makeToast("dialogGetInput using HTML and JavaScript:"+result.which);
}
</SCRIPT></HEAD><BODY></BODY></HTML>
JRuby
droid = Android.new
droid.dialogGetInput "dialogGetInput","using JRuby"
response = droid.dialogGetResponse()['result']
if response['which'] == "positive" then
droid.notify "dialogGetInput using JRuby",response['value']
else
droid.makeToast "dialogGetInput using JRuby:"+response['which']
end
JScheme
(import "com.googlecode.rpc.*")
(define droid (com.googlecode.rpc.Android.))
(.call droid "dialogGetInput" "dialogGetInput" "using JScheme")
(define response (.call droid "dialogGetResponse"))
(define result (.get response "result"))
(if (.equals (.get result "which") "positive")
(.call droid "notify" "dialogGetInput using JScheme" (.get result "value"))
(.call droid "makeToast"
(string-append "dialogGetInput using JScheme:" (.get result "which"))
)
)
(exit)
Jawk
import com.googlecode.rpc.*;
BEGIN{
droid = new Android();
droid.call("dialogGetInput","dialogGetInput","using Jawk");
response = droid.call("dialogGetResponse");
result = response.get("result");
if (result.get("which").equals("positive")) {
droid.call("notify","dialogGetInput using Jawk",result.get("value"));
} else {
droid.call("makeToast","dialogGetInput using Jawk:" result.get("which"));
}
}
Lua
require "android"
android.dialogGetInput("dialogGetInput","using Lua")
result = android.dialogGetResponse().result
if result.which == "positive" then
android.notify("dialogGetInput using Lua",result.value)
else
android.makeToast("dialogGetInput using Lua:"..result.which)
end
PHP
<?php
require_once("Android.php");
$droid = new Android();
$droid->dialogGetInput("dialogGetInput","using PHP");
$result = $droid->dialogGetResponse();
if ($result['result']->which == "positive") {
$droid->notify("dialogGetInput using PHP",$result['result']->value);
} else {
$droid->makeToast("dialogGetInput using PHP:".$result['result']->which);
}
?>
Perl
use Android;
my $droid = Android->new();
$droid->dialogGetInput("dialogGetInput","using Perl");
my $result = $droid->dialogGetResponse();
if ($result->{'result'}{'which'} eq "positive") {
$droid->notify("dialogGetInput using Perl",$result->{'result'}{'value'});
} else {
$droid->makeToast("dialogGetInput using Perl:".$result->{'result'}{'which'});
}
Python
import android
droid = android.Android()
droid.dialogGetInput("dialogGetInput","using Python")
result = droid.dialogGetResponse().result
if result.has_key('which') and result['which'] == 'positive' :
droid.notify("dialogGetInput using Python",result['value'])
else :
droid.makeToast("dialogGetInput using Python:"+result['which'])
Rhino
load("/sdcard/com.googlecode.rhinoforandroid/extras/rhino/android.js");
var droid = new Android();
droid.dialogGetInput("dialogGetInput","using Rhino");
var result = droid.dialogGetResponse();
if (result.which == "positive") {
droid.notify("dialogGetInput using Rhino",result.value);
} else {
droid.makeToast("dialogGetInput using Rhino:"+result.which);
}
Shell
Not solved. Please send me answers if you have.
Sleep
import com.googlecode.rpc.*;
$droid = [new Android];
[$droid call : "dialogGetInput","dialogGetInput","using Sleep"];
$response = [$droid call : "dialogGetResponse"];
$result = [$response get : "result"];
if ([[$result get : "which"] equals : "positive"]) {
[$droid call : "notify","dialogGetInput using Sleep",[$result get : "value"]];
} else {
[$droid call : "makeToast","dialogGetInput using Sleep:".[$result get : "which"]];
}
Squirrel
android <- Android();
function conv4facade(text){
local msg = "";
for(local i = 0;i<text.len();i++){
if (text[i].tochar()=="\"") {
msg+="\\\"";
} else if (text[i].tochar()=="\n") {
msg+="\\n";
} else {
msg+=text[i].tochar();
}
}
return msg;
}
android.dialogGetInput("dialogGetInput","using Squirrel");
local response = android.dialogGetResponse();
if (response.result.which == "positive") {
android.notify("dialogGetInput using Squirrel",conv4facade(response.result.value));
} else {
android.makeToast("dialogGetInput using Squirrel:"+response.result.which);
}
Tcl
Not solved. Please send me answers if you have.
return