Kindly, i need to add image view to the scroll view (SV) from class prod (as in the code shown below, and then i can display message like (you clicked me) when i click on this image.But the below code didnt work and i get ( java.lang.NullPointerException) message!!! So please do you have any idea to help me
Main
Prod Class
Main
B4X:
Sub Globals
Dim P As prod
Dim SV As ScrollView:SV.Initialize (120%Y)
SV.Panel.Color = Colors.Red
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.AddView(SV, 0,0,100%x,100%y)
SV.Panel .AddView (P.a,0,0,30%x,30%y)
End Sub
B4X:
Sub Class_Globals
Public a As ImageView
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
a.Initialize ("aaa")
a.Bitmap=LoadBitmap(File.DirAssets ,"1.jpg")
a.Gravity =Gravity.fill
End Sub
Public Sub aaa
Msgbox("you clicked me","")
End Sub
Last edited: