Android Question CallSub2 Error

AbbasMohammed

Member
Licensed User
Hellow all
Kindly, iam wondering , why this is not working, and how to make it work
Main Activity:

B4X:
Public Sub GetMainIv(prodId As Int) As ImageView
    Return Page(CurrentPage).MainProduct(prodId).MyImage
End Sub

Public Sub GetMainLv(prodId As Int) As Label
    Return Page(CurrentPage).MainProduct(prodId).MyLable
End Sub

Private Sub GetMainColum(prodId As Int) As Int
    Return Page(CurrentPage).MainProduct(prodId).ProdColumn
End Sub

Public Sub GetMainRow(prodId As Int) As Int
    Return Page(CurrentPage).MainProduct(prodId).ProdRow
End Sub
My Class:

B4X:
Private Sub AddMainProducts
    Private Column,Row As Int
    Private ImV As ImageView:ImV.Initialize("ImV")
    Private Lv As Label:Lv.Initialize
    For i=0 To MainProductList.Size-1
    ImV=CallSub2(ParentObject,"GetMainIv",MainProductList.Get(i))
    Lv=CallSub2(ParentObject,"GetMainLv",MainProductList.Get(i))
    Column=CallSub2(ParentObject,"GetMainColum",MainProductList.Get(i))
    Row=CallSub2(ParentObject,"GetMainRow",MainProductList.Get(i))
    ScrlPage.Panel.AddView (ImV,Column,Row ,33%x,33%x)
    ScrlPage.Panel.AddView (Lv,Column,Row+33%x,33%x ,22%x)
    Next
End Sub
https://www.dropbox.com/s/5p90qag03lmwna0/Error.png?dl=0
 

AbbasMohammed

Member
Licensed User
LogCat connected to: B4A-Bridge: samsung SM-G900F
--------- beginning of main
Installing file.
PackageAdded: package:Yamam.User
Installing file.
PackageAdded: package:Yamam.User
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:Yamam.User
** Activity (main) Create, isFirst = true **
Error occurred on line: 97 (pagedisply)
java.lang.NumberFormatException: Invalid double: "null"
at java.lang.StringToReal.invalidReal(StringToReal.java:63)
at java.lang.StringToReal.initialParse(StringToReal.java:164)
at java.lang.StringToReal.parseDouble(StringToReal.java:282)
at java.lang.Double.parseDouble(Double.java:301)
at anywheresoftware.b4a.BA.ObjectToNumber(BA.java:610)
at Yamam.User.pagedisply._addmainproducts(pagedisply.java:275)
at Yamam.User.pagedisply._show(pagedisply.java:110)
at Yamam.User.main._showpage(main.java:495)
at Yamam.User.main._activity_create(main.java:393)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:305)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at Yamam.User.main.afterFirstLayout(main.java:98)
at Yamam.User.main.access$100(main.java:16)
at Yamam.User.main$WaitForLayout.run(main.java:76)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5832)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = true **
Error occurred on line: 97 (pagedisply)
java.lang.NumberFormatException: Invalid double: "null"
at java.lang.StringToReal.invalidReal(StringToReal.java:63)
at java.lang.StringToReal.initialParse(StringToReal.java:164)
at java.lang.StringToReal.parseDouble(StringToReal.java:282)
at java.lang.Double.parseDouble(Double.java:301)
at anywheresoftware.b4a.BA.ObjectToNumber(BA.java:610)
at Yamam.User.pagedisply._addmainproducts(pagedisply.java:275)
at Yamam.User.pagedisply._show(pagedisply.java:110)
at Yamam.User.main._showpage(main.java:495)
at Yamam.User.main._activity_create(main.java:393)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:305)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at Yamam.User.main.afterFirstLayout(main.java:98)
at Yamam.User.main.access$100(main.java:16)
at Yamam.User.main$WaitForLayout.run(main.java:76)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5832)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = true **
Error occurred on line: 97 (pagedisply)
java.lang.NumberFormatException: Invalid double: "null"
at java.lang.StringToReal.invalidReal(StringToReal.java:63)
at java.lang.StringToReal.initialParse(StringToReal.java:164)
at java.lang.StringToReal.parseDouble(StringToReal.java:282)
at java.lang.Double.parseDouble(Double.java:301)
at anywheresoftware.b4a.BA.ObjectToNumber(BA.java:610)
at Yamam.User.pagedisply._addmainproducts(pagedisply.java:275)
at Yamam.User.pagedisply._show(pagedisply.java:110)
at Yamam.User.main._showpage(main.java:495)
at Yamam.User.main._activity_create(main.java:393)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:305)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at Yamam.User.main.afterFirstLayout(main.java:98)
at Yamam.User.main.access$100(main.java:16)
at Yamam.User.main$WaitForLayout.run(main.java:76)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5832)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
** Activity (main) Resume **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:Yamam.User
** Activity (main) Create, isFirst = true **
java.lang.NumberFormatException: Invalid double: "null"
at java.lang.StringToReal.invalidReal(StringToReal.java:63)
at java.lang.StringToReal.initialParse(StringToReal.java:164)
at java.lang.StringToReal.parseDouble(StringToReal.java:282)
at java.lang.Double.parseDouble(Double.java:301)
at anywheresoftware.b4a.BA.ObjectToNumber(BA.java:610)
at Yamam.User.pagedisply._addmainproducts(pagedisply.java:209)
at Yamam.User.pagedisply._show(pagedisply.java:500)
at Yamam.User.main._showpage(main.java:757)
at Yamam.User.main._activity_create(main.java:386)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at Yamam.User.main.afterFirstLayout(main.java:98)
at Yamam.User.main.access$100(main.java:16)
at Yamam.User.main$WaitForLayout.run(main.java:76)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5832)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
java.lang.NumberFormatException: Invalid double: "null"
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:Yamam.User
** Activity (main) Create, isFirst = true **
java.lang.NumberFormatException: Invalid double: "null"
at java.lang.StringToReal.invalidReal(StringToReal.java:63)
at java.lang.StringToReal.initialParse(StringToReal.java:164)
at java.lang.StringToReal.parseDouble(StringToReal.java:282)
at java.lang.Double.parseDouble(Double.java:301)
at anywheresoftware.b4a.BA.ObjectToNumber(BA.java:610)
at Yamam.User.pagedisply._addmainproducts(pagedisply.java:209)
at Yamam.User.pagedisply._show(pagedisply.java:500)
at Yamam.User.main._showpage(main.java:757)
at Yamam.User.main._activity_create(main.java:386)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at Yamam.User.main.afterFirstLayout(main.java:98)
at Yamam.User.main.access$100(main.java:16)
at Yamam.User.main$WaitForLayout.run(main.java:76)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5832)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
 

AbbasMohammed

Member
Licensed User
it contains the following [0, 3, 5, 10, 16, 18, 20, 22, 24, 26, 29, 31, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58]:(
 

AbbasMohammed

Member
Licensed User
by checking with other user with newer version of B4A he says that the program deal with the
MainProduct(prodId) as array and it shows only its length, while i define it as object.... and it show me all its properties and methods!!!
 

AbbasMohammed

Member
Licensed User
Dear Erel,
Is there a solution for this issue, or its bug???? because i have tried many go around like using public variable or list image container but i couldnt solve it till now:(
many thanks
 

lkching7

Member
Licensed User
Actually The Error Very Clear. java.lang.NumberFormatException: Invalid double: "null"
Just Have To Make Sure Don't Pass Null Value
Try Debug More Deeper...
 

AbbasMohammed

Member
Licensed User
Dear sir,
Many thanks for your interest ,iam trying some walk around , if i failed then i shall let you know, and thank you again.....
 
Top