battle programmers alliance
Would you like to react to this message? Create an account in a few clicks or log in to continue.

battle programming a forum for elite programmers with extreme will power to sharpen their skills
HomeGallerySearchRegisterLog in

 new lg dbbbbbb

Go down 

Posts : 293
Join date : 2012-04-17

new lg dbbbbbb Empty
PostSubject: new lg dbbbbbb   new lg dbbbbbb EmptySun Dec 22, 2019 11:29 am

abstract public class AbsDictionaryDB {
    protected Boolean existsInDB =false;
    public abstract void save(String key, String value);
    public abstract  String load(String key);
    public abstract Boolean getExistsInDB();

package com.yotamarker.testdb

import android.content.Context
import android.content.SharedPreferences

class SharedPrefDB(private val context: Context) : AbsDictionaryDB() {
    private val sharedPreferences: SharedPreferences
    private val editor: SharedPreferences.Editor

    init {
        this.sharedPreferences = this.context.getSharedPreferences("t800", Context.MODE_PRIVATE)
        this.editor = this.sharedPreferences.edit()

    override fun save(key: String, value: String) {
        editor.putString(key, value)

    override fun load(key: String): String {
        val result = sharedPreferences.getString(key, "null")
        this.existsInDB = result == "null"
        return result

    override fun getExistsInDB(): Boolean? {
        return existsInDB

battle programming
Back to top Go down
new lg dbbbbbb
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
battle programmers alliance :: battle programming alliance :: chit chat-
Jump to: