Problem with TEXT field

aklisiewicz

Active Member
Licensed User
Longtime User
I have a details activity where I try to retrieve single record from SQLite.

There are no errors on compilation but when I run the App no data is displayed.

The Listview code works fine and looks like this:
B4X:
Sub ListViewFill    
    ListView1.Clear
    Cur = SQL1.ExecQuery(QueryString)
    For i = 0 To Cur.RowCount - 1
        Cur.Position = i
        ListView1.AddSingleLine(Cur.GetString("IssueName"))
    Next
    Cur.Close
End Sub

Sub ListView1_ItemClick (Position As Int, Value As Object)
    ItemSelected = Value
        Main.IssueID =Position
        StartActivity("IssueDetails")
    'CallSubDelayed2(IssueDetails, "LoadDatabase",Cur.Position)
End Sub

The "IssueDetails" activity is called upon selection

B4X:
Sub LoadDatabase(Dir As String, FileName As String)
    Cur.Position = Main.IssueID
    QueryString="SELECT ID, IssueName, FROM issues WHERE ID = "&Main.IssueID
    Cur = SQL1.ExecQuery(QueryString)
    strIssueName.Text = Cur.GetString("IssueName")
    Msgbox(strIssueName.Text,"Issue ID")
    'strSymptoms = Cur.GetString("Symptoms")
    'ImageView_Bitmap     = LoadBitmap(File.DirAssets, Cur.GetString("Image"))
Cur.Close    
End Sub


the second issue (question) I have how would I handle TEXT type fields ?
In the code above the Lavel 'strSymptoms' need to display MEMO like field with multiple lines. Wne I enable this line I get strange error:


strSymptoms = Cur.GetString(\
javac 1.6.0_26
src\com\dps\EssentialDatabase\issuedetails.java:403: inconvertible types
found : java.lang.String
required: android.widget.TextView
mostCurrent._strsymptoms.setObject((android.widget.TextView)(mostCurrent._cur.GetString("Symptoms")));


I also tried to use
B4X:
CallSubDelayed2(IssueDetails, "LoadDatabase",Cur.Position)

but cannot figure out the proper use :-(

any help appreciated
Arthur
 
Last edited:

Mahares

Expert
Licensed User
Longtime User
Try something like this:
B4X:
Sub LoadDatabase(Dir As String, FileName As String)
    If SQL1.IsInitialized=false  Then 
   SQL1.Initialize(Dir , FileName, False)
   End if
    Query1="SELECT ID, IssueName, IssueDescription, Symptoms FROM issues WHERE ID = "&Main.IssueID 
       Cur = SQL1.ExecQuery(Query1)
        Cur.Position=0
        strIssueName = Cur.GetString("IssueName")
        strSymptoms = Cur.GetString("Symptoms")
    Cur.Close    
End Sub
 
Upvote 0

aklisiewicz

Active Member
Licensed User
Longtime User
thank you for trying, but,....
your suggested code doesn't work. I get this error when I try it:

strIssueName = Cur.GetString(\
javac 1.6.0_26
src\com\dps\EssentialDatabase\issuedetails.java:409: inconvertible types
found : java.lang.String
required: android.widget.TextView
mostCurrent._strissuename.setObject((android.widget.TextView)(mostCurrent._cur.GetString("IssueName")));


when I change:

B4X:
 strIssueName = Cur.GetString("IssueName")
to
B4X:
 strIssueName.Text = Cur.GetString("IssueName")
I get no error, but still no data is displayed

"strIssueName" is a screen view which should hold the IssueName string



Arthur
 
Last edited:
Upvote 0
Top