Android Question Error in Connecting to mysql

Shubhankar

Member
Licensed User
@Erel

As requested this is the logs

** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
Response from server: [{"id":"1","course_name":"Basic Excel 2013","course_desc":"Learn basic to intermediate functions of Excel. Simple formulas and features of Microsoft Excel 2013","course_days":"2 Days.","course_rating":"4.68"},{"id":"2","course_name":"Advanced Excel 2013","course_desc":"Learn Pivot Tables, VLookup, Macros & Advanced Functions of Excel.","course_days":"2 Days.","course_rating":"4.87"},{"id":"3","course_name":"Introduction to SQL","course_desc":"Learn to create a SQL database, query a database table and select, insert, update & delete records.","course_days":"2 Days.","course_rating":"4.89"},{"id":"4","course_name":"Facebook Marketing for Business","course_desc":"Learn to use Facebook for marketing your business on your own.","course_days":"1 Day","course_rating":"4.79"}]
(MyMap) {course_name=Basic Excel 2013, id=1, course_rating=4.68, course_days=2 Days., course_desc=Learn basic to intermediate functions of Excel. Simple formulas and features of Microsoft Excel 2013}
(MyMap) {course_name=Advanced Excel 2013, id=2, course_rating=4.87, course_days=2 Days., course_desc=Learn Pivot Tables, VLookup, Macros & Advanced Functions of Excel.}
(MyMap) {course_name=Introduction to SQL, id=3, course_rating=4.89, course_days=2 Days., course_desc=Learn to create a SQL database, query a database table and select, insert, update & delete records.}
(MyMap) {course_name=Facebook Marketing for Business, id=4, course_rating=4.79, course_days=1 Day, course_desc=Learn to use Facebook for marketing your business on your own.}
** Activity (main) Pause, UserClosed = false **
** Activity (openfolder) Create, isFirst = true **
** Activity (openfolder) Resume **
** Activity (openfolder) Pause, UserClosed = false **
** Activity (main) Resume **
Response from server: [{"id":"4","course_name":"Facebook Marketing for Business","course_desc":"Learn to use Facebook for marketing your business on your own.","course_days":"1 Day","course_rating":"4.79","course_prereq":"Must know basic PC skills, and must have a Facebook account.","course_outcomes":"Learn to use Facebook for business use. Understanding Posting, Events, Groups, Pages and make the best use of the most popular Social Media Marketing application.","course_comments":"","course_grant":"SDF, PIC & SkillsFuture"}]
Error occurred on line: 107 (Main)
java.lang.NumberFormatException: Invalid double: "null"
at java.lang.StringToReal.invalidReal(StringToReal.java:63)
at java.lang.StringToReal.parseDouble(StringToReal.java:269)
at java.lang.Double.parseDouble(Double.java:295)
at anywheresoftware.b4a.debug.RDebugUtils.numberCast(RDebugUtils.java:55)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA$2.run(BA.java:328)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4514)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Pause, UserClosed = true **
Fatal signal 11 (SIGSEGV) at 0x00000094 (code=1)
Fatal signal 11 (SIGSEGV) at 0x00000070 (code=1)
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **


The line causing the error is this
lblPopulation.Text = NumberFormat2(m.Get("pagesort"),0, 0, 0, True) & " (K)"

I am uploading the previous code just in case
 

Attachments

  • remotequery problem.zip
    148 KB · Views: 129

Shubhankar

Member
Licensed User
Also I am unsure why my activity is not able to recognise the remotequery function from the main despite putting in main.(functionname)

Main.ExecuteRemoteQuery
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
In Main you are calling
B4X:
    ExecuteRemoteQuery("SELECT id, course_name, course_desc, course_days, course_rating, course_prereq, course_outcomes, course_comments, course_grant FROM mobile WHERE id='" & tl.First & "'", COUNTRY_POPULATION)
    StartActivity(openfolder )
In fact as soon as the job is started (and you dont wait for an answer) but you start another activity. The result of your call will not reach the second activity
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
i did it that way because i was unable to even compile the code if i didnt comment it out
in your second activity you want to start a sub from MAIN which is a mistake. You should place another ExecuteRemoteQuery in your second activity. also the JobDone is needed in the second activity too.

I suggest you to go over the beginners guide again (Reading AND understanding this time please) to find out how to work with two or more acitivities.

Also you need to wait for the answer in Main after your call to
B4X:
ExecuteRemoteQuery("SELECT id, course_name, course_desc, course_days, course_rating, course_prereq, course_outcomes, course_comments, course_grant FROM mobile WHERE id='" & tl.First & "'", COUNTRY_POPULATION)
you need to wait for the JobDone Event is raised... In JobDone you can save the result (or whatever) and start your second activity.
 
Upvote 0

Shubhankar

Member
Licensed User
Managed to solve all the errors in the logs (checked in debug) but now I am unable to get the data to show in the activity window. It just shows as null in the app. I think the remote query values are not going into the load layout file.

Hope you can help .

Thanks
 

Attachments

  • 3rdjan afternoon.zip
    150.9 KB · Views: 144
Upvote 0
Top