Darknight20
Member
Hi
i use this library that have a customview:
https://www.b4x.com/android/forum/threads/arrowdownloadbutton.58720/#content
and when i get this view from a panel with getview() , i cant do anything on view , like when view not initialized!
and i have this problem with some others customview library.
project code:
Log when pnl_Click:
and sometime i get this error when compile:
please help me how i can solve this, Thanks.
Also i attached project and picture.
i use this library that have a customview:
https://www.b4x.com/android/forum/threads/arrowdownloadbutton.58720/#content
and when i get this view from a panel with getview() , i cant do anything on view , like when view not initialized!
and i have this problem with some others customview library.
project code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.Color=Colors.Gray
Dim cls As ColorDrawable
cls.Initialize(Colors.White,15dip)
For i = 1 To 5
Dim pnl As Panel
pnl.Initialize("pnl")
pnl.Background=cls
Activity.AddView(pnl,10dip,(i*80dip),100%x-20dip,70dip)
Dim adb1 As ArrowDownloadButton
adb1.Initialize("adb")
adb1.RingColor = Colors.Blue
adb1.ProgressColor = Colors.yellow
adb1.ProgressTextColor = Colors.white
adb1.ArcWidth = 30
adb1.ProgressTextSize = 60
pnl.AddView(adb1,0,0,0,0)
adb1.Height=60dip
adb1.Width=adb1.Height
adb1.Left=(pnl.Width-adb1.Width)/2
adb1.Top=5dip
If i = 3 Then
adb1.startAnimating 'it works
End If
Next
End Sub
Sub pnl_Click
Dim panel As Panel
panel=Sender
Dim adb2 As ArrowDownloadButton
adb2=panel.GetView(0)
adb2.startAnimating 'it not works
adb2.Top=0 'it not works
End Sub
Log when pnl_Click:
B4X:
Error occurred on line: 64 (Main)
java.lang.NullPointerException: Attempt to invoke virtual method 'void main.java.com.fenjuly.library.ArrowDownloadButton.startAnimating()' on a null object reference
at arrowdownloadbuttonwrapper.arrowDownloadButtonWrapper.startAnimating(arrowDownloadButtonWrapper.java:175)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
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 anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6131)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:892)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:782)
and sometime i get this error when compile:
B4X:
Generating R file. (0.00s)
Compiling generated Java code. Error
B4A line: 63
adb2=panel.GetView(0)
javac 1.8.0_162
src\b4a\example\main.java:431: error: cannot find symbol
_adb2 = (arrowdownloadbuttonwrapper.arrowDownloadButtonWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new arrowdownloadbuttonwrapper.arrowDownloadButtonWrapper(), (main.java.com.fenjuly.library.ArrowDownloadButton)(_panel.GetView((int) (0)).getObject()));
^
symbol: class java
location: class main
please help me how i can solve this, Thanks.
Also i attached project and picture.