Trying to build improved PreferenceActivity

Shay

Well-Known Member
Licensed User
Longtime User
Hi

I need to build improved PreferenceActivity, one which allowing more options, such buttons inside (having 2 buttons after you click, in which each do something else)

so I used one of the examples, and created PreferenceActivity lookalike
the following code will create 1 titile + 1 "standard" button

what is the best why now to take this code, and make it into some "class" so I will not need to copy paste all this many times (as many as my buttons)

I wish to create some class, that will allow me to add buttons / tiltes, etc..

here is the code
(not optimized)

Sub FillScrollView
Dim Bitmap1 As Bitmap
Dim Label1, Label2, Label3 As Label
Dim Panel0, Panel1, Panel2 As Panel
Dim ImageView1 As ImageView
Dim PanelTop, PanelHeight, Label2Top As Int
Dim Text1, Text2, TitleLabel1 As String

Text1="My Name:"
Text2="Click to set my name"
TitleLabel1="My Details:"

Bitmap1.Initialize(File.DirAssets,"arrows-left_small.png")

PanelTop=30
Panel0=scvMain.Panel
Panel0.Color=Colors.Gray

Panel1.Initialize("View")
Panel2.Initialize("Title")
Label1.Initialize("View")
Label2.Initialize("View")
Label3.Initialize ("Title")
ImageView1.Initialize("View")

Panel1.Tag=10

PanelHeight=70dip
Label2Top=45dip

Panel0.AddView(Panel2,0,0,scvMain.Width,30)
Panel0.AddView(Panel1,0,PanelTop,scvMain.Width,PanelHeight)

Panel1.Color=Colors.RGB (48,48,48)
Panel2.Color=Colors.RGB(5,65,117)

Panel2.AddView(Label3,10dip,0dip,240dip,30dip)
Label3.Text = TitleLabel1
Label3.TextColor = Colors.White

Panel1.AddView(Label1,50dip,5dip,240dip,30dip)
Label1.Color=Colors.RGB (48,48,48)
Label1.TextColor = Colors.White
Label1.Tag=11
Label1.TextSize=20
Label1.Text = Text1


Panel1.AddView(Label2,130dip,Label2Top,240dip,30dip)
Label2.TextSize=14
Label2.TextColor = Colors.RGB(85,164,242)
Label2.Tag=12
Label2.Text=Text2

ImageView1.Tag=16
Panel1.AddView(ImageView1,5dip,25dip,30dip,30dip)
ImageView1.Bitmap=Bitmap1


PanelTop=PanelTop+PanelHeight+1dip


Panel0.Height=PanelTop


End Sub
 
Top