B4A Library ColorPickerLibrary

It comes from here. You need to add some Java code to the library in order to return the selected colours to the B4A activity - not difficult to do. Leaving it up to you...

1.Extract LibRes.zip and copy the extracted folder to be on the same folder level as that of the /Files and /Objects folders of the B4A project
2. Extract DemoRes.zip and copy the extracted folder to be on the same folder level as that of the /Files and /Objects folders of the B4A project
3. Extract resource.zip (see post #2) and copy the extracted folder to be on the same folder level as that of the /Files and /Objects folders of the B4A project
4. Copy the library files to your additional library folder.
5. You will also need the following in your additional library folder
a. a recent version of android-support-annotations.jar
b. a recent version of android-support-v4.jar
c. a recent version of android-support-v7-appcompat.jar​
6. You also need to download AppCompat V3.20 and (at least) DesigSupport (V2.00) from the forum and have them in your additional library folder.



B4X:
#Region  Project Attributes
    #ApplicationLabel: b4aColorPickerLibrary
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
#End Region

#AdditionalRes: ..\resource
#AdditionalRes: ..\DemoRes
#AdditionalRes: ..\LibRes

'#AdditionalRes: C:\Users\----------2\Documents\Basic 4 Android\JOHAN APPS\JHS LIBS\resource\b4a_appcompat, de.amberhome.objects.appcompat
'#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
'#AdditionalRes: C:\Android\extras\google\google-play-services\libproject\google-play-services_lib\res, com.google.android.gms
'#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\android\support\design\res, android.support.design

'#ExcludeClasses: .games, .drive, .ads, .fitness, .wearable, .measurement, .cast, .auth, .nearby
'#ExcludeClasses: .tagmanager, .analytics, .wallet, .plus, .gcm, .maps, .panorama

'#Extends: android.support.v7.app.AppCompatActivity

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
  

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private Button1 As Button
    Dim cpl As ColorPickerLibrary
  
  
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
  
  
    Activity.LoadLayout("main")
    cpl.Initialize("")

End Sub

Sub Activity_Resume
  

  
End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
  
    cpl.startColorPickerLibrary

End Sub

B4A Manifest:
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="22"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@style/MyAppTheme")

'AddManifestText(<uses-feature android:name="android.hardware.camera" />)
'AddManifestText(<uses-feature android:name="android.hardware.camera.autofocus" />)
'AddManifestText(<uses-feature android:name="android.hardware.camera.flash" />)

AddApplicationText(<activity android:name="com.enrico.sample.MainActivity">

        </activity>
        <activity
            android:name="com.enrico.sample.PreferenceActivity"
            android:label="@string/settings"></activity>)
          
'AddPermission(android.permission.CAMERA) ' Required to be able to access the camera device.      
'AddPermission(android.permission.GET_TASKS)
'AddPermission("android.hardware.camera")
'AddPermission("android.permission.FLASHLIGHT"

1.png



2.png


3.png


4.png


5.png
 

Attachments

  • LibRes.zip
    5.3 KB · Views: 284
  • TheJavaCode.zip
    14.1 KB · Views: 256
  • DemoRes.zip
    33.6 KB · Views: 271
  • ColorPickerLibraryLibFiles.zip
    40.3 KB · Views: 284
  • b4aColorPickerLibrary.zip
    8.6 KB · Views: 275
Last edited:
Top