DatePicker

BeanShell

source("/sdcard/com.googlecode.bshforandroid/extras/bsh/android.bsh");
droid = Android();
droid.call("makeToast","Input your birthday");
now = java.util.Calendar.getInstance();
year = now.get(now.YEAR);
month = now.get(now.MONTH)+1;
day = now.get(now.DAY_OF_MONTH);
droid.call("dialogCreateDatePicker",year,month,day);
droid.call("dialogShow");
response = droid.call("dialogGetResponse").get("result");
droid.call("dialogDismiss");
age = year-response.get("year");
if ( (month<response.get("month")) || 
  ((month==response.get("month"))&&(day<response.get("day"))) ) {
  age--;
}
droid.call("dialogCreateAlert","Dialog","Age:"+age);
droid.call("dialogSetPositiveButtonText","OK");
droid.call("dialogShow");
droid.call("dialogGetResponse");
droid.call("dialogDismiss");

Bex

include("/sdcard/com.googlecode.bexforandroid/extras/bex/android.bex")
droid = Android()
droid.call("makeToast","Input your birthday")
now = java::util::Calendar.getInstance()
year = now.get(now.YEAR)
month = now.get(now.MONTH)+1
day = now.get(now.DAY_OF_MONTH)
droid.call("dialogCreateDatePicker",year,month,day)
droid.call("dialogShow")
response = droid.call("dialogGetResponse").get("result")
droid.call("dialogDismiss")
age = year-response.get("year")
if ( month < response.get("month") ) {
  age--
} {
  if ( month == response.get("month") ) {
    if ( day < response.get("day") ) {
      age--
    }
  }
}
droid.call("dialogCreateAlert","Dialog","Age:"+age)
droid.call("dialogSetPositiveButtonText","OK")
droid.call("dialogShow")
droid.call("dialogGetResponse")
droid.call("dialogDismiss")

Erlang

-module(datePicker_Erlang).
-export([main/0]).
main()->
  android:makeToast("Input your birthday"),
  {Year,Month,Day} = date(),
  android:dialogCreateDatePicker(Year,Month,Day),
  android:dialogShow(),
  Response = android:dialogGetResponse(),
  android:dialogDismiss(),
  { struct,[{_,M2},{_,Y2},{_,D2},{_,Result}]} = Response,
  Age = age(Year,Y2,Month,M2,Day,D2),
  Msg = string:concat("Age:",integer_to_list(Age)),
  android:dialogCreateAlert("Dialog",Msg),
  android:dialogSetPositiveButtonText("OK"),
  android:dialogShow(),
  android:dialogGetResponse(),
  android:dialogDismiss().

age(Year,Y2,Month,M2,Day,D2)->
  if Month < M2 -> Year - Y2 - 1;
     Month =:= M2 ->
       if Day < D2 -> Year - Y2 - 1;
          true -> Year - Y2
       end;
     true -> Year - Y2
  end.

Html and JavaScript

<HTML><HEAD><SCRIPT>
var droid = new Android();
droid.makeToast("Input your birthday");
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth()+1;
var day = now.getDate()+1;
droid.dialogCreateDatePicker(year,month,day);
droid.dialogShow();
var response = droid.dialogGetResponse().result;
droid.dialogDismiss();
var age = year-response["year"];
if ( (month<response["month"]) || 
  ((month==response["month"])&&(day<response["day"])) ) {
  age--;
}
droid.dialogCreateAlert("Dialog","Age:"+age);
droid.dialogSetPositiveButtonText("OK");
droid.dialogShow();
droid.dialogGetResponse();
droid.dialogDismiss();
</SCRIPT></HEAD><BODY></BODY></HTML>

JRuby

droid = Android.new
droid.makeToast "Input your birthday"
now = Time.now
year = now.year
month = now.mon
day = now.day
droid.dialogCreateDatePicker year,month,day
droid.dialogShow
response = droid.dialogGetResponse()['result']
droid.dialogDismiss
age = year-response['year']
if ( (month<response['month']) || 
  ((month==response['month'])&&(day<response['day'])) ) then
  age-=1
end
droid.dialogCreateAlert "Dialog","Age:"+age.to_s
droid.dialogSetPositiveButtonText "OK"
droid.dialogShow
droid.dialogGetResponse
droid.dialogDismiss

JScheme

(import "com.googlecode.rpc.*")
(define droid (com.googlecode.rpc.Android.))
(.call droid "makeToast" "Input your birthday")
(define now (Calendar.getInstance))
(define year (.get now (.YEAR$ now)))
(define month (+ (.get now (.MONTH$ now)) 1))
(define day (.get now (.DAY_OF_MONTH$ now)))
(.call droid "dialogCreateDatePicker" year month day)
(.call droid "dialogShow")
(define response (.get (.call droid "dialogGetResponse") "result"))
(.call droid "dialogDismiss")
(define age (- year (.get response "year")))
(if (or (< month (.get response "month")) (and (= month (.get response "month")) (< day (.get response "day"))))
 (set! age (- age 1))
)
(.call droid "dialogCreateAlert" "Dialog" (string-append "Age:" age))
(.call droid "dialogSetPositiveButtonText" "OK")
(.call droid "dialogShow")
(.call droid "dialogGetResponse")
(.call droid "dialogDismiss")
(exit)

Jawk

import com.googlecode.rpc.*;
BEGIN{
  droid = new Android();
  droid.call("makeToast","Input your birthday");
  now = java.util.Calendar.getInstance();
  year = now.get(now.YEAR);
  month = now.get(now.MONTH)+1;
  day = now.get(now.DAY_OF_MONTH);
  droid.call("dialogCreateDatePicker",year,month,day);
  droid.call("dialogShow");
  response = droid.call("dialogGetResponse").get("result");
  droid.call("dialogDismiss");
  age = year-response.get("year");
  truth = 0;
  if ( month<response.get("month") ) {
    truth = 1;
  } else if ( month==response.get("month") ) {
    if ( day<response.get("day") ) {
      truth = 1;
    }
  }
  if (truth == 1) {
    age--;
  }
  droid.call("dialogCreateAlert","Dialog","Age:" age);
  droid.call("dialogSetPositiveButtonText","OK");
  droid.call("dialogShow");
  droid.call("dialogGetResponse");
  droid.call("dialogDismiss");
}

Lua

require "android"
now = os.date("*t")
year = now.year
month = now.month
day = now.day
android.dialogCreateDatePicker(year,month,day)
android.dialogShow()
response = android.dialogGetResponse().result
android.dialogDismiss()
age = year-response.year
if ( (month<response.month) or 
  ((month==response.month) and (day<response.day)) ) then
  age=age-1
end
android.dialogCreateAlert("Dialog","Age:"..age)
android.dialogSetPositiveButtonText("OK")
android.dialogShow()
android.dialogGetResponse()
android.dialogDismiss()

PHP

<?php 
require_once("Android.php");
$droid = new Android();
$droid->makeToast("Input your birthday");
$now = getdate();
$year = $now['year'];
$month = $now['mon'];
$day = $now['mday'];
$droid->dialogCreateDatePicker($year,$month,$day);
$droid->dialogShow();
$response = $droid->dialogGetResponse();
$droid->dialogDismiss();
$age = $year-$response['result']->year;
if ( ($month<$response['result']->month) || 
  (($month==$response['result']->month)&&($day<$response['result']->day)) ) {
  $age--;
}
$droid->dialogCreateAlert("Dialog","Age:".$age);
$droid->dialogSetPositiveButtonText("OK");
$droid->dialogShow();
$droid->dialogGetResponse();
$droid->dialogDismiss();
?>

Perl

use Android;
my $droid = Android->new();
$droid->makeToast("Input your birthday");
my ($sec,$min,$hour,$day,$month,$year,$wday,$yday,$isdst) = localtime(time);
$year+=1900;
$month+=1;
$droid->dialogCreateDatePicker($year,$month,$day);
$droid->dialogShow();
$response = $droid->dialogGetResponse();
$droid->dialogDismiss();
my $age = $year-$response->{'result'}{'year'};
if ( ($month<$response->{'result'}{'month'}) || 
  (($month==$response->{'result'}{'month'})&&($day<$response->{'result'}{'day'})) ) {
  $age--;
}
$droid->dialogCreateAlert("Dialog","Age:".$age);
$droid->dialogSetPositiveButtonText("OK");
$droid->dialogShow();
$droid->dialogGetResponse();
$droid->dialogDismiss();

Python

import datetime
import android
droid = android.Android()
droid.makeToast("Input your birthday");
now = datetime.datetime.today();
year = now.year;
month = now.month;
day = now.day;
droid.dialogCreateDatePicker(year,month,day);
droid.dialogShow();
response = droid.dialogGetResponse().result;
droid.dialogDismiss();
age = year-response['year'];
if ( (month<response['month']) or 
  ((month==response['month']) and (day<response['day'])) ) :
  age=age-1;
droid.dialogCreateAlert("Dialog","Age:"+str(age));
droid.dialogSetPositiveButtonText("OK");
droid.dialogShow();
droid.dialogGetResponse();
droid.dialogDismiss();

Rhino

load("/sdcard/com.googlecode.rhinoforandroid/extras/rhino/android.js");
var droid = new Android();
droid.makeToast("Input your birthday");
var now = new java.util.Calendar.getInstance();
var year = now.get(now.YEAR);
var month = now.get(now.MONTH)+1;
var day = now.get(now.DAY_OF_MONTH);
droid.dialogCreateDatePicker(year,month,day);
droid.dialogShow();
var response = droid.dialogGetResponse();
droid.dialogDismiss();
var age = year-response.year;
if ( (month<response.month) || 
  ((month==response.month)&&(day<response.day)) ) {
  age--;
}
droid.dialogCreateAlert("Dialog","Age:"+age);
droid.dialogSetPositiveButtonText("OK");
droid.dialogShow();
droid.dialogGetResponse();
droid.dialogDismiss();

Shell

Not solved. Please send me answers if you have.

Sleep

import com.googlecode.rpc.*;
$droid = [new Android];
[$droid call : "makeToast","Input your birthday"];
$now = [java.util.Calendar getInstance];
$year = [$now get : [$now YEAR]];
$month = [$now get : [$now MONTH]] + 1;
$day = [$now get : [$now DAY_OF_MONTH]];
[$droid call : "dialogCreateDatePicker",$year,$month,$day];
[$droid call : "dialogShow"];
$response = [[$droid call : "dialogGetResponse"] get : "result"];
[$droid call : "dialogDismiss"];
$age = $year - [$response get : "year"];
if ( ( $month < [$response get : "month"] ) || 
  (( $month == [$response get : "month"] ) && ( $day < [$response get : "day"] ) ) ) {
  $age--;
}
[$droid call : "dialogCreateAlert","Age:".$age];
[$droid call : "dialogSetPositiveButtonText","OK"];
[$droid call : "dialogShow"];
[$droid call : "dialogGetResponse"];
[$droid call : "dialogDismiss"];

Squirrel

android <- Android();
android.makeToast("Input your birthday");
local now = date();
local year = now.year;
local month = now.month+1;
local day = now.day;
android.dialogCreateDatePicker(year,month,day);
android.dialogShow();
local response = android.dialogGetResponse().result;
android.dialogDismiss();
local age = year-response.year;
if ( (month<response.month) || 
  ((month==response.month)&&(day<response.day)) ) {
  age--;
}
android.dialogCreateAlert("Dialog","Age:"+age);
android.dialogSetPositiveButtonText("OK");
android.dialogShow();
android.dialogGetResponse();
android.dialogDismiss();

Tcl

source /sdcard/com.googlecode.tclforandroid/extras/tcl/android/android.tcl
set droid [android]
$droid makeToast "Input your birthday"
set year [clock format [clock seconds] -format {%Y}]
set month [clock format [clock seconds] -format {%m}]
set day [clock format [clock seconds] -format {%e}]
$droid dialogCreateDatePicker $year $month $day
$droid dialogShow
array set result [$droid dialogGetResponse]
$droid dialogDismiss
set age [expr $year-$result(year)]
if { [expr $month<$result(month)] || 
  [expr { [expr $month==$result(month)] && [expr $day<$result(day)] } ] } {
  incr age -1
}
$droid dialogCreateAlert "Dialog" "Age:$age"
$droid dialogSetPositiveButtonText "OK"
$droid dialogShow
$droid dialogGetResponse
$droid dialogDismiss

unset droid
unset year
unset month
unset day
array unset result
unset age
return