Open damonkohler opened 9 years ago
From @GoogleCodeExporter on May 31, 2015 11:30
Logcat, please. http://code.google.com/p/android-scripting/wiki/LogcatDump
Original comment by rjmatthews62
on 14 Apr 2012 at 12:22
From @GoogleCodeExporter on May 31, 2015 11:30
btw the program is below also, its a version of the py example
here:http://code.google.com/p/android-scripting/wiki/FullScreenUI
use Android;
my $droid = Android->new();
#print "Started";
$layout=<<EOF;
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/background"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent" android:background="#ff000000">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/linearLayout1">
<Button android:id="@+id/button1" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Test 1"></Button>
<Button android:id="@+id/button2" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Ok"></Button>
<Button android:id="@+id/button3" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Cancel"></Button>
</LinearLayout>
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content" android:text="TextView"
android:id="@+id/textView1" android:textAppearance="?android:attr/textAppearanceLarge" android:gravity="center_vertical|center_horizontal|center"></TextView>
<EditText android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/editText1"
android:tag="Tag Me" android:inputType="textCapWords|textPhonetic|number">
<requestFocus></requestFocus>
</EditText>
<CheckBox android:layout_height="wrap_content" android:id="@+id/checkBox1" android:layout_width="234dp" android:text="Howdy, neighbors." android:checked="true"></CheckBox>
</LinearLayout>
EOF
#print $layout;
$droid->fullShow($layout);
eventloop();
$query=$droid->fullQuery();
print "\n=== query hash: "; printhash ($query); print "\n";
$querydetail=$droid->fullQueryDetail("editText1");
print "\n=== querydetail hash: "; printhash ($querydetail); print "\n";
#print "Data entered = ",$droid->fullQueryDetail("editText1");
$droid->fullDismiss();
print "\n\n\n\n\n";
sub eventloop {
while ($i<5) {
$event=$droid->eventWait();
print "=== event hash: "; printhash ($event); print "\n";
print "=== result hash: "; printhash ($event->{result}); print "\n";
print "=== data hash: "; printhash ($event->{result}->{data}); print "\n";
print "\n\n";
if ($event{"name"} eq "click") {
$id=$event{"data"}{"id"};
if ($id eq "button3") { return; }
elsif ($id eq "button2") { $droid->fullSetProperty("editText1","text","OK has
been pressed"); }
elsif ($id eq "button1") {
$droid->fullSetProperty("textView1","text","Other stuff here");
print $droid->fullSetProperty("background","backgroundColor","0xff7f0000");
}
elsif ($event{"name"} eq "screen") {
if ($event{"data"} eq "destroy") { return; }
}
}
$i++;
}
}
sub printhash {
local ($hashName) = @_;
print "{";
foreach $key (sort keys %$hashName) {
print "$key => $$hashName{$key}, ";
}
print "}";
}
First, im having trouble understanding the results of $droid->eventWait(), it
returns a hash with an ID key, but stangely, the ID is not the ID in the XML,
its a serial ID, for each call of the function, shouldnt it be the widget ID as
in the PY?
Second, when I call $droid->fullSetProperty("editText1","text","OK has been
pressed"), for instance (or any fullsetProperty), I get a
java.lang.nullpointerexception.
Am I doing something terrible wrong?
Original comment by aod...@gmail.com
on 20 Apr 2012 at 1:33
Attachments:
From @GoogleCodeExporter on May 31, 2015 11:30
Also, need a more complete logcat... this is showing only 'exceptions'. I need
to see the sl4a rpc sequences.
Original comment by rjmatthews62
on 20 Apr 2012 at 1:56
From @GoogleCodeExporter on May 31, 2015 11:30
I followed the logcat instructions, is there a parameter?
Em Sex, 2012-04-20 às 01:56 +0000, android-scripting@googlecode.com
escreveu:
Original comment by aod...@gmail.com
on 20 Apr 2012 at 3:06
From @GoogleCodeExporter on May 31, 2015 11:30
Original issue reported on code.google.com by
aod...@gmail.com
on 21 Mar 2012 at 8:17Copied from original issue: damonkohler/android-scripting#615