B4A Library AHPreferenceActivity Library

This Library is based on Erels PreferenceActivity Library and adds some hopefully useful things:

  • Checkbox entry can show On and Off summary
  • Dependencies to other entries
  • Another Listview type with Map as value/displayvalue pairs
  • AddPassword() for password entries
  • AddRingtone() for selecting notification, ringtone or alert sound

V1.01:
  • Bugfix for FC with nested PreferencesScreens
  • Added support for calling Intents (other activities)
  • Preferencescreens support dependency

V1.02:
  • Bugfix for GetUpdatedKeys not working sometimes (thanks, Erel)

V1.03:
  • Never published

V1.04:
  • Added AddEditText2() method with support for InputType and some other properties
  • !!! Changed package name to "de.amberhome.objects" !!! Change in your Manifest!

For a tutorial see PreferenceActivity Tutorial
 

Attachments

  • AHPreferenceActivityExample.zip
    6.6 KB · Views: 1,975
  • AHPreferenceActivity1_02.zip
    21.4 KB · Views: 1,893
  • AHPreferenceActivity1_04.zip
    22.1 KB · Views: 2,456
  • AHPreferenceActivityExample1_04.zip
    7.1 KB · Views: 1,870
Last edited:

kiki78

Active Member
Licensed User
Longtime User
Thank you corwin42 for this useful library.

Have you progress for color picker implementation ?

Regards,
Kiki
 

corwin42

Expert
Licensed User
Longtime User
Have you progress for color picker implementation ?
No and I probably won't add it. Preference Activities are not really supported with Materail Design. I currently think of another system to create Preference Screens. Don't know if I will make it public because it will need (the not free) UltimateListView.
 

Straker

Active Member
Licensed User
Longtime User
Hi Corwin42, you wrote a very useful library!
I'm guessing if it's possible to retrieve/set the values from the lists not by name but by index.
I'm writing a multi-language app and the list content is localized (of course) and therefore when the user switch to another language all preferences goes back to default (except boolean values, obviously).

Second question: is it possible to use this library also to store some app's internal setting (strings)?
 

Straker

Active Member
Licensed User
Longtime User
Opps! Sorry. Your lib has also a MAP which solves my problem
 

peacemaker

Expert
Licensed User
Longtime User
Is it possible to use several different Managers in the app ?
One for User Settings, and another for dynamic adding\editing the other data by the user.
 

corwin42

Expert
Licensed User
Longtime User
Is it possible to use several different Managers in the app ?
One for User Settings, and another for dynamic adding\editing the other data by the user.
No, the manager always uses the same settings file.
 

peacemaker

Expert
Licensed User
Longtime User
No, the manager always uses the same settings file.
it's a pity. With InputType textboxes this interface is rather friendly to dynamically interact with user for fill the table data, record, by record, with clear comment and data type control, without Activity interface creation. Ecpecially, if variable database columns set.

Maybe possible to clone the lib with another shared settings ? And another object type, say with "2" suffix :)
 
Last edited:

pesquera

Active Member
Licensed User
Longtime User
Hi, Is there a way to do an intent for sharing a URL? I'm trying with this code, but it's not correct (the App is stopped)
B4X:
Dim loc_intent_Info As Intent
loc_intent_Info.Initialize(loc_intent_Info.ACTION_SEND, "")
loc_intent_Info.SetType("text/plain")
loc_intent_Info.SetComponent("https://www.xxx")
loc_Category1.AddIntent("Compartir", "Info", loc_intent_Info, "")
 

Scantech

Well-Known Member
Licensed User
Longtime User
Is it possible to use dependancy from a list. Perhaps add a second dependancy in the method call. First Dependancy is the key and second is the data selected from a list which will be enabled.

Thanks
 

maleche

Active Member
Licensed User
Longtime User
Where is the AHpreference Library!?
I can find the examples, but unable to locate the download link?
Thanks!
 

DonManfred

Expert
Licensed User
Longtime User

trueboss323

Active Member
Licensed User
Longtime User
Hello,
Could you please update this library for Click events? This is an absolute must feature I need to have!
 
Last edited:

itgirl

Active Member
Licensed User
Longtime User
No and I probably won't add it. Preference Activities are not really supported with Materail Design. I currently think of another system to create Preference Screens. Don't know if I will make it public because it will need (the not free) UltimateListView.
any progress on the preference screen with ULV ? can you share with us ?
 

corwin42

Expert
Licensed User
Longtime User
Hello,
Could you please update this library for Click events? This is an absolute must feature I need to have!

This is not a simple change and no, I won't add it.

any progress on the preference screen with ULV ? can you share with us ?

Sorry. I haven't started with it, yet.
 

JohnC

Expert
Licensed User
Longtime User

Steve Piehl

Member
Licensed User
Longtime User
Hi, I am trying to use the AddEditText2 option to create a numeric input box for accepting an IP address. The problem I am having is that the InputType parameter when set to 2 doesn't allow for input of the period (or decimal point). I have read up on the other input types (https://developer.android.com/reference/android/text/InputType.html#TYPE_CLASS_NUMBER) and it appears that I should be able to set the parameter to 8192 to get an inputbox that allows numbers and decimals (which would presumably present the period/decimal point as an input option).

Does the AddEditText2 support the "TYPE_NUMBER_FLAG_DECIMAL"? If it does could my problem be device specific?

B4X:
cat1.AddEditText2("edit1", "IP Address", "Enter the IP Address", "192.168.1.1", 8192, False, True, "")

In the code snippet above, I just get a normal keyboard as the input option.

Any help is appreciated. Thanks!
 

Steve Piehl

Member
Licensed User
Longtime User
OK, I gather that this won't work the way I wanted (for IP Addresses).

However, I wasn't able to get the EditText2 to display an appropriate Input box using the "8192" InputType. I was only able to get a keypad display with 0-9 (no decimal point or +/- sign key) like I expected the input box to look. Is this a bug in the AHPerferences library?
 
Top