ListView1.Add(CreateListItem(titles(0),ListView1.AsView.Width,50dip),50dip,titles(2))
LogCat connected to: B4A-Bridge: Sony Ericsson ST17i-358510041014453
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
** Service (widget2x1) Start **
** Service (widget2x1) Start **
** Service (widget2x1) Start **
** Service (widget2x1) Start **
** Service (widget2x1) Start **
** Activity (home) Resume **
** Activity (home) Pause, UserClosed = false **
running waiting messages (21)
** Activity (main) Resume **
** Service (service1) Destroy **
** Service (service1) Create **
** Service (service1) Start **
Connected to B4A-Bridge (Wifi)
** Service (service1) Destroy **
** Service (service1) Create **
** Service (service1) Start **
Connected to B4A-Bridge (Wifi)
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:b4a.example
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (home) Create, isFirst = true **
** Activity (home) Resume **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
** Service (httputils2service) Start **
** Activity (home) Pause, UserClosed = false **
** Activity (games) Create, isFirst = true **
java.lang.NullPointerException
at anywheresoftware.b4a.objects.ViewWrapper.getWidth(ViewWrapper.java:128)
at b4a.example.games._listviewmanager(games.java:491)
at b4a.example.games._activity_create(games.java:318)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at b4a.example.games.afterFirstLayout(games.java:98)
at b4a.example.games.access$100(games.java:16)
at b4a.example.games$WaitForLayout.run(games.java:76)
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:4441)
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:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
** Service (widget2x1) Start **
ListView1.Add(CreateListItem(titles(0),ListView1.AsView.Width,50dip),50dip,titles(2))
Sub ListViewManager
ListView1.Initialize(Me, "ListView1")
splitstrings = Regex.split(Chr(13)&Chr(10), File.GetText(File.DirRootExternal, "data.txt"))
For i = 0 To splitstrings.Length - 1
titles = Regex.split(",", splitstrings(i))
ListView1.Add(CreateListItem(titles(0),ListView1.AsView.Width,50dip),50dip,titles(2))
Next
End Sub
Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
Dim Panel1 As Panel
Panel1.Initialize("")
Panel1.Color = Colors.Black
Dim Button1 As Button
Dim Label1 As Label
Label1.Initialize("")
Button1.Initialize("button") 'all buttons click events will be handled with Sub Button_Click
Panel1.AddView(Label1, 5dip, 2dip, 150dip, Height - 4dip) 'view #0
Panel1.AddView(Button1, 155dip, 2dip, 110dip, Height - 4dip) 'view #1
Panel1.AddView(ListView1,0,0,100%x,100%y)
ListView1.Add(CreateListItem(titles(0),ListView1.AsView.Width,50dip),50dip,titles(2))
Button1.Text = "Download"
Label1.Gravity = Bit.OR(Gravity.CENTER_VERTICAL, Gravity.LEFT)
Label1.Text = Text
Label1.TextSize = 16
Label1.TextColor = Colors.Black
Return Panel1
End Sub
sm.Initialize("sm")
Dim offset As Int = 60%x
sm.BehindOffset = offset
sm.Mode = sm.LEFT
clv3.Initialize(Me, "clv3")
sm.Menu.AddView(clv3.AsView, 10dip, 47dip, 100%x - offset - 20dip, 100%y)
For i = 1 To 3
clv3.Add(CreateListItem("Graph" & i, clv3.AsView.Width, 50dip), 50dip, "Graph" & i)
Next
clv3.Add(CreateListItem("hello", clv3.AsView.Width, 50dip), 50dip, "hello")
Dim b2 As Bitmap
b2.Initialize(File.DirAssets,"bg2.png")
sm.Menu.SetBackgroundImage(b2)
clv3.Color = Colors.Transparent 'gives error
clv3.ScrollingBackgroundColor = Colors.Transparent ''gives error
Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
Dim p As Panel
p.Initialize("")
p.Color = Colors.Transparent 'doesn't work
Dim b As Bitmap
b.Initialize(File.DirAssets,"success.png")
Dim i As ImageView
i.Initialize("")
i.Bitmap = b
Dim lbl As Label
lbl.Initialize("lbl")
lbl.Text = Text
lbl.TextSize = 16
lbl.TextColor = Colors.White
p.AddView(i, 0,0,Height,Height)
p.AddView(lbl, Height+5dip,0,Width/3,Height)
Return p
End Sub
Dim pnl As Panel
pnl = listApk.GetPanel(itemKey)
Dim b As Button
b = pnl.GetView(1)
Log("b: " & b.Text)