Android Question Animate activity with one anim

devmobile

Active Member
Licensed User
According to below post
https://www.b4x.com/android/forum/threads/animations-for-activities.22770/#post-132044
I animate activity with 2 file
But i have one file example sequential.xml that i want to use it only
But when i use relate sub,it get error because i cannot send one argument to method
B4X:
Sub SetAnimation(InAnimation As String, OutAnimation As String)
    Dim r As Reflector
    Dim package As String
    Dim In, out As Int
    package = r.GetStaticField("anywheresoftware.b4a.BA", "packageName")
    In = r.GetStaticField(package & ".R$anim", InAnimation)
    out = r.GetStaticField(package & ".R$anim", OutAnimation)
    r.Target = r.GetActivity
    r.RunMethod4("overridePendingTransition", Array As Object(In, out), Array As String("java.lang.int", "java.lang.int"))
End Sub
 

devmobile

Active Member
Licensed User
If i call below
B4X:
SetAnimation("bounce")
B4X:
Sub SetAnimation(InAnimation As String)
    Dim r As Reflector
    Dim package As String
    Dim In As Int
    package = r.GetStaticField("anywheresoftware.b4a.BA", "packageName")
    In = r.GetStaticField(package & ".R$anim", InAnimation)
    r.Target = r.GetActivity
    r.RunMethod4("overridePendingTransition", Array As Object(In), Array As String("java.lang.int"))
End Sub
Then this error
java.lang.NoSuchFieldException: No field in class Lb4a/example/R$anim; (declaration of 'b4a.example.R$anim' appears in /data/app/b4a.example-1/base.apk)

*** I remove second argument from function
 
Upvote 0

devmobile

Active Member
Licensed User
And if use use
B4X:
SetAnimation("bounce","")
it show below error
java.lang.NoSuchFieldException: No field in class Lb4a/example/R$anim; (declaration of 'b4a.example.R$anim' appears in /data/app/b4a.example-1/base.apk)
 
Upvote 0

webjefe

Member
Licensed User
Longtime User
Hello, I'm also getting java.lang.NoSuchFieldException. I had an older version of b4a. I'm recompiling wit 8.8. It works fine when I do it from one computer. I moved al my files to another computer also with 8.8.
I get the same error whether I try to load an image with:

ImgName = "flagusa2_2"
myFlag.Bitmap = GetPngFromResource(ImgName)

or with:

Sub SetNinePatchDrawable(Control As View, ImageName As String)
Dim r As Reflector
Dim package As String
Dim id As Int
package = r.GetStaticField("anywheresoftware.b4a.BA", "packageName")
id = r.GetStaticField(package & ".R$drawable", ImageName)
r.Target = r.GetContext
r.Target = r.RunMethod("getResources")
Control.Background = r.RunMethod2("getDrawable", id, "java.lang.int")
End Sub

It all work fine when I compile from my other computer into the same device. The only difference is: On the computer that works I'm connecting via bluethooth and on the computer that fails, I'm connecting via USB.

Thanks
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Please use [CODE]code here...[/CODE] tags when posting code.

codetag001.png

codetag002.png

codetag003.png
 
Upvote 0
Top