B4A Library AHPreferenceActivity Library

corwin42

Expert
Licensed User
Longtime User

This works on my N7 without problem, too. Even if I make a list with 1000 entries.
 

peacemaker

Expert
Licensed User
Longtime User
So.... only 5.0 emulator problem ?
 

corwin42

Expert
Licensed User
Longtime User

corwin42

Expert
Licensed User
Longtime User

peacemaker

Expert
Licensed User
Longtime User
Seems, solved - sorry for alarming about the lib, the issue was in resource string using "%" symbol
 

Martin Larsen

Active Member
Licensed User
Longtime User
Thanks for this great library!

Is there a way to add an edit text with numbers only? To use for phonenumbers ...

Also, what about a negative dependency? Only enable a setting if a checkbox is not clicked?

Like:

Invoice address [ somewhere ]
Use same for shipping [ X ]
Shipping address (disabled because we use the same address)

I know I could negate the sentence! but is it possible to negate the condition?
 
Last edited:

Martin Larsen

Active Member
Licensed User
Longtime User
Sorry, one more question.

The font size for the titles in the setting is pretty large. How can I change the font size for these?
 

Dadeda

Member
Licensed User
Longtime User
is it possible to apply a custom theme to the activity that is created for the preferences ?
 

corwin42

Expert
Licensed User
Longtime User
is it possible to apply a custom theme to the activity that is created for the preferences ?

It should be possible to set the theme for the PreferenceActivity in the manifest. But be aware this works only for the main preference activity. SubActivities will not have the theme. This is a drawback of the PreferenceActivity.
 

corwin42

Expert
Licensed User
Longtime User
Thanks for this great library!

Is there a way to add an edit text with numbers only? To use for phonenumbers ...

Also, what about a negative dependency? Only enable a setting if a checkbox is not clicked?

With AddEditText2() you can specify an InputType. Set it to EditText.INPUT_TYPE_NUMBERS or EditText.INPUT_TYPE_PHONE.

Negative dependencies are not possible.

Sorry, one more question.

The font size for the titles in the setting is pretty large. How can I change the font size for these?

The Style of the PreferenceActivity should be the default style of the device. The only way I can think of changing this would be to create a custom theme for the PreferenceActivity and make the changes in the Theme.
 

Martin Larsen

Active Member
Licensed User
Longtime User
The Style of the PreferenceActivity should be the default style of the device. The only way I can think of changing this would be to create a custom theme for the PreferenceActivity and make the changes in the Theme.

For some reason the font is about 50% bigger than in the settings of all my other apps. Could be something in my manifest, will look into it.
 

Dadeda

Member
Licensed User
Longtime User
It should be possible to set the theme for the PreferenceActivity in the manifest. But be aware this works only for the main preference activity. SubActivities will not have the theme. This is a drawback of the PreferenceActivity.
I've done that, added a custom theme in the manifest editor and it works great ;-)
 

Dadeda

Member
Licensed User
Longtime User
Can you please show what you added?

Just change this line you have to add initially :
B4X:
AddApplicationText(<activity android:name="de.amberhome.objects.preferenceactivity"/>)

To this :
B4X:
AddApplicationText(
<activity
  android:name="de.amberhome.objects.preferenceactivity"
  android:theme="@style/MyTheme">
</activity>
)
where MyTheme is your custom theme.
 

pesquera

Active Member
Licensed User
Longtime User
Hi, I need to open an Activity into a PreferenceActivity. That Activity is for getting an image (photo)
I'm doing something wrong. How can I do that?
B4X:
    Dim loc_Intent As Intent
    loc_Intent.Initialize(loc_Intent.ACTION_MAIN,"scr_mifoto")
    loc_Categoria_Parametros.AddIntent("Mi Foto", "xxx", loc_Intent,"")
Thanks in advance
 

corwin42

Expert
Licensed User
Longtime User
Try the following:

If your activity that gets the image is called "GetImageActivity" add the following in the manifest editor (replace <your package name> with the apps package name):

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

B4X:
Dim loc_intent As Intent
loc_intent.Initialize("<your package name>.action.GETIMAGE", "")
loc_intent.SetComponent(Application.PackageName & "/.getimageactivity")
loc_Categoria_Parametros.AddIntent("Mi Foto", "", loc_Intent, "")

Because of Application.PackageName this only works with B4A 4.0 and above. If you use an older version search the forum how to get the package name.
You can name the action whatever you want. It just should be unique so I added the package name.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…