B4A Library PreferenceActivity library

PreferenceActivity v1.01 is available.
See the tutorial for more information: http://www.b4x.com/forum/basic4andr...orials/10608-preferenceactivity-tutorial.html

preference_1.png



Installation instructions:
- Unzip the attached file.
- Copy both files to the internal libraries folder: C:\Program Files\Anywhere Software\Basic4android\Libraries

V1.01 released - fixes a bug with GetUpdatedKeys method
 

Attachments

I just added a AddList2() method which accepts a map object for the values. The key of the map is the value that will be saved with the preferences and the value of the map gets displayed.

@Erel:

How should I share this change? Should I just post it here or should I create a new thread? Or should I send the source to you and you will add it to the first post?

I want to do some other changes. Mainly the possibility to change the description of an entry after the user changed a value. Since this can only be done with a service and it is somehow complicated are you planning to create a new Preference Activity type directly in the IDE? This would simplify things a lot.
 
If you intend to do more changes then it is better to fork this library and create PreferenceActivityAdvanced (or something like that).
Ok, will do it this way.
 
run in fullscreen

Erel,

is there a way to run the PreferenceScreen in fullscreen?

THX

M
 
Hello,

does anybody knows if is still not possible to edit strings like "This is List1" with the user selected value?

Thanks

Hi Erel,

I would like if the list (List1) selects the text ("Black", "Red," "Green", "Blue") is displayed and does not always "This is List1".

Code:
Sub CreatePreferenceScreen
   screen.Initialize("Settings", "")
   'create two categories
   Dim cat1, cat2 As PreferenceCategory
   cat1.Initialize("Category 1")
   cat1.AddCheckBox("check1", "Checkbox1", "This is Checkbox1", True)
   cat1.AddCheckBox("check2", "Checkbox2", "This is Checkbox2", False)
   cat1.AddEditText("edit1", "EditText1", "This is EditText1", "")
   
   cat2.Initialize("Category 2")
   cat2.AddList("list1", "List1", "This is List1", "", _
        Array As String("Black", "Red", "Green", "Blue"))
      
   'add the categories to the main screen
   screen.AddPreferenceCategory(cat1)
   screen.AddPreferenceCategory(cat2)
End Sub

How can I make it?

Ciao,
Filippo
 
how can I delete a single item instead of all!

HTML:
code library

public void ClearAll () {
             Editor and sp.edit = ();
             e.clear ();
             e.commit ();
         }

example

Code:
Sub createsetting (s1 As String, value As String)
manager.SetString (s1, value)
end Sub

Code:
Sub readSetting (s1 As String) As String
Return manager.GetString (s1)
end Sub

Code:
Sub deleteallsetting (s1 As String)
manager.ClearAll
end Sub

Code:
Sub deletesettingvoice (s1 as String)
        ????????????????????????????????????
end Sub

:wav:
 
don't work on android 2.2.1 !

i call this code and it work in 3.2:

Code:
StartActivity(screen.CreateIntent)
from what sdk level it works?
 
i've resolved!
the problema was in the KEYNAME !
the key name LockScreenMode crash application (reserved?)
Code:
    catGeneral.AddList("LockScreenMode", "Lock the screen in portrait or landscape mode", "Select to Lock the screen in portrait or landscape mode",  "AutoUnlocked", _
        Array As String("AutoUnlocked", "Portrait", "Landscape", "ReversedPortrait", "ReversedLandscape"))

changing the name it work!

Code:
    catGeneral.AddList("LockScreenOrientationMode", "Lock the screen in portrait or landscape mode", "Select to Lock the screen in portrait or landscape mode",  "AutoUnlocked", _
        Array As String("AutoUnlocked", "Portrait", "Landscape", "ReversedPortrait", "ReversedLandscape"))
 
Storing passwords needs some encription.
Is it possible to encript\decript externally (before\after saving\loading a password preference)?
 
Back
Top