New answers tagged

4

Welcome to Kotlin! Consider this. // Define constructor this way class UserSettings(context: Context) { // Prefixes for fields are rather uncommon in the Kotlin world. // You could remove the type declaration here - Kotlin will infer it for you private val prefs: SharedPreferences = context .getSharedPreferences("UserSettings", Context....


3

I'll start this post off with a notice that my knowledge of the Java language isn't very high. However, I have a lot of experience with development in languages like C# and JavaScript so there are a few things I can help with. Most of my code below will be pseudo-code, but I did research more proper syntax and import statements to clean it up a bit. Based ...


1

Simply call this code: DatabaseHelper db = new DatabaseHelper(this); db.OpenDB(); try { db.CreateTable(new myClass1()); db.CreateTable(new myClass2()); ... } catch (Exception e) { e.printStackTrace(); } Be aware that there are database upgrades which can't be automated so straightforwardly. E.g. the ...


Top 50 recent answers are included