Latest Posts

[Android] Kotlin으로 Realm 사용하기

Posted on 2017-04-23 23:38:48

최근에 Java에서 Kotlin으로 갈아탔는데, Kotlin으로 Realm을 사용하는 예제가 많지 않아서 포스트를 작성하였다.   Realm을 사용하려면 먼저 Realm library를 초기화해야 한다. class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Initializes the Realm library and creates a default configuration that is ready to use. // It is required to call this method before interacting with any other of the Realm API's. Realm.init(this) } }   그리고 그 다음은 model class...