Please how do i do something like this?
Contents loaded from my database
load the data from database and create one or more notifications for themContents loaded from my database
What layout should i use and how do i create a notification?load the data from database and create one or more notifications for them
they do not have any layout.What layout should i use
Dim n As Notification
n.Initialize
n.Icon = "icon"
n.SetInfo("This is the title", "and this is the body.", Main) 'Change Main to "" if this code is in the main module.
n.Notify(1)
You can use xclv to create such a Layout in your activity. But NOT as a Notification...can a custom listview, Give me the layout structure?
Please, can you show me a sampleYou can use xclv to create such a Layout in your activity. But NOT as a Notification...
Alright. Thank you.No, never build such a layout. You need to do it by yourself
The relevant thread is here:
[B4X] [XUI] xCustomListView - cross platform CustomListView
Update: As several other libraries depend on xCustomListView library, it is no longer recommended to use the code module. Use the library instead. There are several extension classes that add more features to xCLV. They are listed at the end of this post. Video tutorial: xCustomListView is...www.b4x.com
Thank youIt seems the items are expandable, you could use this, based in xCustomListView too
[B4X] CLVExpandable - Allows expanding or collapsing xCustomListView items
This class replaces the custom CustomListView module (https://www.b4x.com/android/forum/threads/b4x-xui-expandable-list-based-on-xcustomlistview.86449/). It works with the standard xCustomListView library. It is compatible with B4A, B4i and B4J. Instructions: An expandable item layout should...www.b4x.com
Sub LoadOneRow(i As Int) As B4XView
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0 ,0,0,100%x, 180dip)
p.LoadLayout("OneRow")
Label1.Text = Label1.Text & " " & i
Label2.Text = "Hello xxxxxxxxxxxxxxxxxxx" & CRLF & "Next line of some annoucement text"
Dim myDt As Long = DateTime.Now
Label3.Text = DateUtils.GetDayOfWeekName(myDt) & ", " & DateUtils.GetMonthName(myDt) & " " & DateTime.GetDayOfMonth(myDt)
p.Tag = i
Return p
End Sub
Sub LoadMyRows
Dim i As Int
For i = 1 To 10
Dim obj As Object
CustomListView1.Add(LoadOneRow(i), obj)
Next
End Sub
This is for the layout itself. Correct.So, the result should look something like this
Dim today As Long = DateTime.Now
DateTime.DateFormat = "EEE d MMM yyyy"
Log($"${DateTime.Date(today)}"$)
Sa. 11 Jan. 2020
thank you soo much Albert. I'm truly grateful for your help.Ok, we assume you are using xCustomList view. This is a nice approach since you can layout one row something like this:
View attachment 87381
And as per say xCustomListView example, then your code to load up one row will look like:
B4X:Sub LoadOneRow(i As Int) As B4XView Dim p As B4XView = xui.CreatePanel("") p.SetLayoutAnimated(0 ,0,0,100%x, 180dip) p.LoadLayout("OneRow") Label1.Text = Label1.Text & " " & i Label2.Text = "Hello xxxxxxxxxxxxxxxxxxx" & CRLF & "Next line of some annoucement text" Dim myDt As Long = DateTime.Now Label3.Text = DateUtils.GetDayOfWeekName(myDt) & ", " & DateUtils.GetMonthName(myDt) & " " & DateTime.GetDayOfMonth(myDt) p.Tag = i Return p End Sub
So, in above, (use the DateUtils library - the above line for label3.text = shows the format I used.
So, the result should look something like this:
View attachment 87382
So the line for date assumes that myDt has a date. In the above, I just passing "i" in a for next loop, but in your case you would be grabbing data from the database.
So my small loop that feeds the "one row load" routine is this:
B4X:Sub LoadMyRows Dim i As Int For i = 1 To 10 Dim obj As Object CustomListView1.Add(LoadOneRow(i), obj) Next End Sub
(in your case, you could/would pass the row of data.
Regards,
Albert D. Kallal
Edmonton, Alberta Canada
Dim myDt As Long = DateTime.Now
Label3.Text = DateUtils.GetDayOfWeekName(myDt) & ", " & DateUtils.GetMonthName(myDt) & " " & DateTime.GetDayOfMonth(myDt)
DateTime.DateFormat = "EEEE d MMMM yyyy"
thank you soo much Albert. I'm truly grateful for your help.
You can avoid the first step.So I learned that after adding files to the project (main IDE - windows->Files manager). You THEN have to add the files "again" while in the layout designer.