-1

i am trying to learning Xamarin and while i'm at it, i'm also learning SQLite. Though i am currently struggling on how i can export the SampleDb.db i have in my Assets Folder to somewhere (like Personal Folder inside) of Android File System.

My problem is that i can't seem to get an access to AssetManager on a separate class.

i've tried extending my class to BaseControl : Activity and/or BaseControl : MainActivity and this is what happens

enter image description here

i also tried to add a reference to Android.Content.Res via using Android.Content.Res and intantiating AssetManager and this is what happens

enter image description here

while it is true that i can use this void method if i place it in the MainActivity Class, i don't want to do such a thing because i'd want this to be separated.

hoping i can pick some tips and tricks here. thanks

TheQuestioner
  • 702
  • 10
  • 28

1 Answers1

1

since after posting this question, i continued to search for a solution on the entire web. another user posted the same problem as i have on a different website but it turns out that the his approach (his approach didn't worked for him, i don't know why) worked for me.

so what i did was, change the Assets.Open(DbFile) to Application.Context.Assets.Open(DbFile) and it worked. well, i haven't tested it yet but the app didn't throw me any kind of exception and as i traced the flow via breakpoint, things went smoothly

TheQuestioner
  • 702
  • 10
  • 28