Logging in Android with Timber
In this article I show you how to use timber for logging in your Android App. Timber is built upon Android’s Log class. If you are not yet familiar with logging in Android have a look at Logging in Android
In this article I show you how to use timber for logging in your Android App. Timber is built upon Android’s Log class. If you are not yet familiar with logging in Android have a look at Logging in Android
Logging brings some light into the darkness of your code. If you are new to logging please have a look at Log4j2 for Kotlin Import import android.util.Log Tag class MainActivity : AppCompatActivity() { companion object { const val TAG = “MainActivity” } Log statement override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) Log.d(TAG, “onCreate”) } Logcat Further…
In Part 1 we dealt with the simplest form of initialization with the primary constructor: class Planet( val diameter: Int, val distanceToSun: Double, val mass: Double ) But wait: there is more: Init block The primary constructor cannot contain any code so init block for the rescue: class Planet( val diameter: Int, val distanceToSun: Double,…
Download German dictionary http://www.winedt.org/dict.html Unzip Put de_neu.dic into your project folder Preferences -> Editor -> Spelling -> Add Custom dictionary Select path for de_neu.dic Open Ok
Why is there a car in the picture? – Because it has class! Jokes aside, classes are still the building blocks of modern object oriented software design. And of course as the new kid on the block Kotlin has it’s own take on this subject. Declaration Let’s look at the most basic class declaration: class…
1901 Annie Jump Cannon constructed this classification: Class Temperature in K Color O >= 30000 blue B 10000 – 30000 blue white A 7500 -10000 white F 6000 – 7500 yellow white G 5200 – 6000 yellow K 3700 – 5200 light orange M 2400 – 3700 orange red Mnemoic: Oh, Be A Fine Galaxy,…
The version of the YouTube API service installed on this device is not valid. -> Update YouTube app 🙂
Dependency Add the following to your dependencies implementation(org.jetbrains.kotlinx:kotlinx-datetime:0.2.0) Usage import kotlinx.datetime.* val today = Clock.System.todayAt(TimeZone.currentSystemDefault()) If you target Android devices running below API 26, you need to use Android Gradle plugin 4.0 or newer and enable core library desugaring. https://github.com/Kotlin/kotlinx-datetime
The easiest way to add external dependencies with local jar files to your gradle is: dependencies { implementation(files(“libs/YouTubeAndroidPlayerApi.jar”)) If you don’t want to add every lib individually you can use: dependencies { implementation fileTree(‘libs’)
Kotlin has its own keyword to create list which are mutable As a child I learned that our solar system has nine planets val planets = mutableListOf(“Mercury”, “Venus”, “Earth”, “Mars”, “Jupiter”, “Saturn”, “Uranus”, “Neptune”, “Pluto”) println(planets) In 2006 Pluto was reclassified as a dwarf planet. So let’s remove Pluto planets.remove(“Pluto”) println(planets)