I'm sure it's something obvious but I can't figure out where I'm going wrong,
I'm using the tabstrip to swipe between various layouts and I wish to load data from a JSON file, I've designed the layouts and loaded them
And I've loaded the JSON data but I can't find a way to populate the various days, a sample JSON
Does anyone have any idea they could pass my way to populate the various pages
I've tried the following from an example but it doesn't populate the layouts
Appreciate some guidance, if it can be done, thanks
I'm using the tabstrip to swipe between various layouts and I wish to load data from a JSON file, I've designed the layouts and loaded them
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("frmmain")
TabStrip1.LoadLayout("ScrollView", "Intro")
ScrollView1.Panel.Height = 600dip
ScrollView1.Panel.LoadLayout("intro")
TabStrip1.LoadLayout("ScrollView", "Day1")
ScrollView1.Panel.Height = 1400dip
ScrollView1.Panel.LoadLayout("day1")
TabStrip1.LoadLayout("ScrollView", "Day2")
ScrollView1.Panel.Height = 1400dip
ScrollView1.Panel.LoadLayout("day2")
TabStrip1.LoadLayout("ScrollView", "Day3")
ScrollView1.Panel.Height = 1400dip
ScrollView1.Panel.LoadLayout("day3")
TabStrip1.LoadLayout("ScrollView", "Day4")
ScrollView1.Panel.Height = 1400dip
ScrollView1.Panel.LoadLayout("day4")
TabStrip1.LoadLayout("ScrollView", "Day5")
ScrollView1.Panel.Height = 1400dip
ScrollView1.Panel.LoadLayout("day5")
configtabstrip
End Sub
And I've loaded the JSON data but I can't find a way to populate the various days, a sample JSON
B4X:
For i = 1 To 5
Dim strI As String = i
Dim d1 As Map = day.Get(strI)
days(i) = d1.Get("date")
rain(i) = d1.Get("rain")
symbolV(i) = d1.Get("symbol_value")
Dim sun As Map = d1.Get("sun")
sunrise(i) = sun.Get("in")
sunset(i) = sun.Get("out")
tempmax(i) = d1.Get("tempmax")
Next
Does anyone have any idea they could pass my way to populate the various pages
I've tried the following from an example but it doesn't populate the layouts
B4X:
Sub TabStrip1_PageSelected (Position As Int)
Log("Page current is " & Position &".Please add any code to make something!!")
lbl00Description.Text = symbolV(Position)
lblDate.Text = days(Position)
lblMTemp.Text = tempmax(Position)
lblSrise.Text = sunrise(Position)
lblSSet.Text = sunset(Position)
lblMRise.Text = moonrise(Position)
lblMSet.Text = moonset(Position)
End Sub
Appreciate some guidance, if it can be done, thanks