0

How to load data from db just after the app launch?

hello, I'm learning xamarin, android c# development and I can't just find a solution.. how to write full statement - if database is not empty, then set this textview on MainLauncher as data from this database? At the beginning, database is empty. I want the user to input data in DialogFragment which shows after button click, and then when he opens app, data is automatically showed om the screen. I tried something like this, but I had crashes and bugs and that's impossible for me...(onCreate) if(db.table<MyDatabase>().Count() != 0){ // is not empty, but here is first error textview.Text = db.Get<MyDatabase>(1) }

4th Sep 2018, 5:48 AM
Adam
Adam - avatar
1 Respuesta
+ 1
hi adam, Maybe you can take a look at NULL and ANY. Try yo debug te problem with a try/catch block. It will profide you with a bit more info. also you should look up debugging in VS. Because you can use a breakpoint and see where the error is created and wy It shows up. Best Of Luck!!!
26th Oct 2018, 4:43 AM
Jeremie de Vos
Jeremie de Vos - avatar