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:

Gawro777

Member
Licensed User
Longtime User
It is not possible to open custom dialogs. What you can try is to open a new (invisible) activity which immediately opens a custom dialog. On exiting the dialog you can close the activity then.

You can use the AddIntent() method to open an activity:

...

And add this to the manifest so the activity listens to the action:

B4X:
AddActivityText(MyActivity, <intent-filter>
              <action android:name="your.package.name.action.OPENACTIVITY" />
              <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>)

you can use any string for the action.


Thats exactly what I want to do. But I am too nube and this explanation is not enough to me. Anyone can post some example of using "invisible" activity to show dialog on it?
Specifically I want to show time picker dialog from MaterialDateTimePicker library.
I don't know how to create activity added to AHPreference catergory and make it to execute timePicker.show (timePicker As TimePickerDialog).

Would be great if anyone can help.
 

Ian Garton

Member
Licensed User
Longtime User
Is this library still the choice for implementation of preferences? Or is there another 'best practice' method now days?
There are a few things with this library that in an ideal world could be changed.
 

corwin42

Expert
Licensed User
Longtime User
Is this library still the choice for implementation of preferences? Or is there another 'best practice' method now days?
There are a few things with this library that in an ideal world could be changed.

There is nothing better for now. There are plans to wrap this library but it will take some time (Maybe I should start a Kickstarter project for wrapping libraries :)).
 

manicmonkey

Member
Licensed User
Longtime User
Hi, Sorry if this is a dumb question but I am still very new to B4A.

I am using your Design Support Library for the NavDrawer and MD ActionBar look. When I click settings however the preferences screen does no look right. I would ideally like the return arrow link and Settings in a way that matches the main ActionBar. I'm not sure if this is possible or how to achieve it though???
 

corwin42

Expert
Licensed User
Longtime User
Hi, Sorry if this is a dumb question but I am still very new to B4A.

I am using your Design Support Library for the NavDrawer and MD ActionBar look. When I click settings however the preferences screen does no look right. I would ideally like the return arrow link and Settings in a way that matches the main ActionBar. I'm not sure if this is possible or how to achieve it though???

This is not possible. I'm currently working on a new preferences library which will fully support AppCompat/Material Design...
 

manicmonkey

Member
Licensed User
Longtime User
This is not possible. I'm currently working on a new preferences library which will fully support AppCompat/Material Design...
That sounds great, I look forward to it.

fyi - I'll be happy to donate for any libraries used once I publish.
Thanks :)
 

antonomase

Active Member
Licensed User
Longtime User
Hi,

Is it possible to use the HandleSetting event or another method to get the value of a ListBox and change the Summary : something like "Choose color - selected color = blue" every time the user changes the value in the list ?

Thanks
 
Last edited:
Top