msharma-boop / android-scripting

Automatically exported from code.google.com/p/android-scripting
0 stars 0 forks source link

fullSetProperty not working on perl #615

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What device(s) are you experiencing the problem on?
Motorola Droid3

What firmware version are you running on the device?
2.3.3

Im trying to use the new fullscreenUI in perl, fullShow for instance works and 
displays the page, but fullSetProperty drops me java.lang.NullPointerException.

Has anyone had same problem? I am running sl4a_r5x and followed the examples. 
Btw the same code does work in python.

Original issue reported on code.google.com by aod...@gmail.com on 21 Mar 2012 at 8:17

GoogleCodeExporter commented 9 years ago
Logcat, please. http://code.google.com/p/android-scripting/wiki/LogcatDump

Original comment by rjmatthews62 on 14 Apr 2012 at 12:22

GoogleCodeExporter commented 9 years ago

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:

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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