B4A Library DrawView

A shortcut wrap for this Github project. Posting:
1. B4A sample project (b4aDrawView.zip)
2. B4A library files - copy them to your additional library folder (DrawViewLibFiles.zip)
3. The Java Code - change it to suite your needs
4. Other jar files required - copy them to you additional library folder (OtherJars.zip)
5. resource.zip - extract the folder and copy it to be on the same folder level as that of the /Objects and /Files folder of the B4A project
6. LibRes.zip - extract the folder and copy it to be on the same folder level as that of the /Objects and /Files folder of the B4A project
7. DemoRes.zip - extract the folder and copy it to be on the same folder level as that of the /Objects and /Files folder of the B4A project

You need to enable libs AppCompat (V3.20) and DesignSupport (V2.00) for this to work in B4A V6.00+

Take note of the B4A manifest files.
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="23"/>
<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.byox.drawviewproject.SplashScreenActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
        </activity>
        <activity android:name="com.byox.drawviewproject.MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar"/>)

Sample Code:
B4X:
#Region  Project Attributes
    #ApplicationLabel: b4aDrawView
    #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 dv As DrawView
  
  
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")
    dv.Initialize("")

End Sub

Sub Activity_Resume
  

  
End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
  
    dv.startDV

End Sub

Take note of the Undo/Redo buttons at the top right of the UI
 

Attachments

  • resource.zip
    423 bytes · Views: 285
  • LibRes.zip
    775 bytes · Views: 311
  • TheJavaCode.zip
    20 KB · Views: 287
  • b4aDrawView.zip
    8.4 KB · Views: 301
  • DrawViewLibFiles.zip
    64.5 KB · Views: 305
  • DemoRes.zip
    151.4 KB · Views: 297
  • OtherJars.zip
    283.8 KB · Views: 312
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
1.png


2.png


3.png


4.png


5.png
 
Top