This is a collection of commonly used functions in Android apps from BaltiApps.
Feel free to use and contribute.
App should have an "app instance class" extending Application
class.
That class should be registered in the android:name
component of the application manifest.
Example:
class AppInstance: Application() {
...
}
<manifest ...>
<application
...
android:name=".AppInstance">
...
</application>
</manifest>
- Clone this repo/download as zip and extract.
- In your Android Studio project, goto
File -> New -> Import module
- Navigate to the the extracted folder and click
Ok
Verification: go tobuild.gradle
of yourapp
module and check if dependencies have this:Go toimplementation project(path: ':baltitoolbox')
settings.gradle
file and check if the module is included:include ':app', ':baltitoolbox'
- Register the
init
function inonCreate
of your app instance classimport balti.module.baltitoolbox.ToolboxHQ class AppInstance: Application() { ... override fun onCreate() { ... ToolboxHQ.init(this) } }
- Done! Now you can use this library
All functions are "static". Hence they can be used from anywhere in the app.