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

  • PreferenceActivity.zip
    15.3 KB · Views: 1,389

corwin42

Expert
Licensed User
Longtime User
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.
 

corwin42

Expert
Licensed User
Longtime User
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.
 

madru

Active Member
Licensed User
Longtime User
run in fullscreen

Erel,

is there a way to run the PreferenceScreen in fullscreen?

THX

M
 

icebold

Member
Licensed User
Longtime User
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".

B4X:
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
 

ivanomonti

Expert
Licensed User
Longtime User
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

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

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

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

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

:wav:
 

stefanoa

Active Member
Licensed User
Longtime User
don't work on android 2.2.1 !

i call this code and it work in 3.2:

B4X:
StartActivity(screen.CreateIntent)
from what sdk level it works?
 

stefanoa

Active Member
Licensed User
Longtime User
i've resolved!
the problema was in the KEYNAME !
the key name LockScreenMode crash application (reserved?)
B4X:
    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!

B4X:
    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"))
 

peacemaker

Expert
Licensed User
Longtime User
Storing passwords needs some encription.
Is it possible to encript\decript externally (before\after saving\loading a password preference)?
 

DonManfred

Expert
Licensed User
Longtime User
Top