This is my code
and this is the error below
B4X:
Private Query As String
Private Curs As Cursor
Query = "SELECT DISTINCT Account,Names, Class,Stream,Amount FROM Balances WHERE ID = " & Starter.IDList.Get(Starter.CurrentIndex)
Curs = Starter.SQL1.ExecQuery(Query)
Curs.Position = 0
'lblSelectedItem.Text = Curs.GetString("Names") & " " & Curs.GetString("Class")& " " & Curs.GetString("Amount")
Account.Text = Curs.GetString("Account")
Curs.Close
and this is the error below
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
ExecuteHtml: SELECT DISTINCT Names,Class || Stream As CS,Amount As Balance FROM Balances
** Activity (main) Pause, UserClosed = false **
** Activity (accountstatement) Create, isFirst = true **
ExecuteHtml: SELECT DISTINCT Names,Class || Stream As CS,Amount As Balance FROM Balances
23/12/2018 15:04:00
23/12/2018 15:04:00
** Activity (accountstatement) Resume **
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
** Service (httputils2service) Start **
(JSONTokener) at character 0 of [{"ACCOUNT":"05-05586","TITTLE":null,"TRDATE":null,"TREF":"OB","DESCRIPT":"Opening Balance","DEBITAMNT":693800,"CREDITAMNT":null,"BAL":693800}]
Account: 05-05586
TITTLE: null
TREF: OB
TRDATE: null
DESCRIPT: Opening Balance
DEBITAMNT: 693800
CREDITAMNT: null
BAL: 693800
Invalid date: null
01/01/1970
** Activity (accountstatement) Pause, UserClosed = false **
** Activity (statementdisplay) Create, isFirst = true **
ExecuteHtml: SELECT DISTINCT Names,DESCRIPT,DEBITAMNT,CREDITAMNT,TREF,TRDATE,BAL As Balance FROM Statement
** Activity (statementdisplay) Resume **
** Activity (statementdisplay) Pause, UserClosed = true **
** Activity (accountstatement) Resume **
Error occurred on line: 98 (Accountstatement)
android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
at android.database.AbstractCursor.checkPosition(AbstractCursor.java:460)
at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50)
at anywheresoftware.b4a.sql.SQL$CursorWrapper.GetString(SQL.java:377)
at de.amberhome.slidemenuexample.accountstatement._updateselecteditem(accountstatement.java:1167)
at de.amberhome.slidemenuexample.accountstatement._wbvtable_overrideurl(accountstatement.java:1201)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:733)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:355)
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:175)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.objects.WebViewWrapper$1.shouldOverrideUrlLoading(WebViewWrapper.java:64)
at android.webkit.WebViewClient.shouldOverrideUrlLoading(WebViewClient.java:73)
at com.android.webview.chromium.WebViewContentsClientAdapter.shouldOverrideUrlLoading(WebViewContentsClientAdapter.java:339)
at org.chromium.android_webview.AwContentsClient.shouldIgnoreNavigation(AwContentsClient.java:168)
at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(AwContentsClientBridge.java:256)
at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:39)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
** Service (starter) Destroy (ignored)**
** Activity (accountstatement) Pause, UserClosed = true **