Android Question BlinkTextView added in Designer

mmieher

Active Member
Licensed User
Longtime User
Are you still out there? I am not having any luck with a SMMBlinkTextView simply added with the Designer. Should not have to do anything right?

I tried adding Reflection library, but to no avail. Also, the log is not happy at all: "Library 'BlinkTextViewWrapper' is not used. (warning #32)"

I just want to blink, man.

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 20 (B4XMainPage)
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1058)
    at b4a.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1060)
    at b4a.example.b4xpagesmanager._showpage(b4xpagesmanager.java:417)
    at b4a.example.b4xpagesmanager._addpage(b4xpagesmanager.java:245)
    at b4a.example.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:259)
    at b4a.example.b4xpagesmanager._initialize(b4xpagesmanager.java:165)
    at b4a.example.main._activity_create(main.java:415)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at b4a.example.main.afterFirstLayout(main.java:105)
    at b4a.example.main.access$000(main.java:17)
    at b4a.example.main$WaitForLayout.run(main.java:83)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7656)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:336)
    at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:285)
    ... 24 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
    ... 25 more
Caused by: java.lang.RuntimeException: java.lang.ClassCastException: smm.SBlinkTextViewWrapper.BlinkTextViewWrapper cannot be cast to anywheresoftware.b4a.keywords.Common$DesignerCustomView
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
    at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
    at anywheresoftware.b4a.objects.B4XViewWrapper.LoadLayout(B4XViewWrapper.java:312)
 

Attachments

  • Test.zip
    9.8 KB · Views: 158

mmieher

Active Member
Licensed User
Longtime User
This all works. vxAbort is just a dummy label added in the Desginer that is not enabled or visible.

B4X:
Dim Blink As SMMBlinkTextView
    Blink.Initialize("vxAbort")
    Dim b4xBlink As B4XView = Blink
    b4xBlink.SetLayoutAnimated(0, vxAbort.Left, vxAbort.Top, vxAbort.Width, vxAbort.Height)
    b4xBlink.SetColorAndBorder(0xFF7FFF00, 2dip, clrApp, 6dip)   '  the illusive ColorDrawable
    b4xBlink.SetTextAlignment("CENTER","CENTER")
    b4xBlink.TextColor = vxAbort.TextColor
    b4xBlink.TextSize = vxAbort.TextSize
    b4xBlink.Text = "A B O R T"
    Blink.AddToParent(xPage, vxAbort.Left, vxAbort.Top, vxAbort.Width, vxAbort.Height)
    Blink.BringToFront
 
Upvote 0

udg

Expert
Licensed User
Longtime User
Just blinking? Did you have a look at this very old lib of mine.?
If not for the lib itself, it could give you a simple hint on a standard Android component.
 
Upvote 0

mmieher

Active Member
Licensed User
Longtime User
Shouldn't be that hard to create a B4X view, then you can add it in the designer and additionally in all IDE's of B4X.
If that's a solution for you, I'll do it quickly.
Thank you, Alexander. Doing something exactly like that is high on my "to learn" list.

I was mistakenly hung up for a bit thinking that events would not fire during a Sleep. Turned out that the click would not work when the view was briefly "off". Transparent label over the blinking thing fixed it.

I use so much of your stuff. If I ever make a dime on anything, I'll be hitting the Donate button.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
Thank you, Alexander. Doing something exactly like that is high on my "to learn" list.
I had a short break earlier, so I did this quickly, since I'm not at home, I could only test the whole thing in B4J, later I'll publish it officially, but you can see if it works as well as the other library. :)

You can add this view with the designer or per code
B4X:
'Creates as view per code
Dim Blink As AS_BlinkTextView
Blink.Initialize(Me,"Blink")
Blink.AddToParent(Root,0,0,50dip,50dip)
Blink.Text = "Test"
Blink.Font = xui.CreateDefaultBoldFont(20)
Blink.TextColor = xui.Color_White
Blink.AnimationDuration = 250
Blink.StartBlink
Animation.gif
 

Attachments

  • AS BlinkTextView Example.zip
    11.3 KB · Views: 163
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
 
Upvote 0
Top