Home » Android » Where is my file in Android application(Xamarin)?

Where is my file in Android application(Xamarin)?

Posted by: admin November 1, 2017 Leave a comment

Questions:

I wrote a test Android app in Xamarin, where sample data was stored in a file. Somehow I copied test data file to emulator, successfully run the app and forgot about the project for couple of months.

Now I am resuscitating the project and – I can’t find the file in Android Device Manager although it is still accessible in the emulator. It drives me nuts, I need to edit it!

Perhaps someone can point me to the right way to locate the file. Thanks!

Following is the code fragment that reads the file. I added debug output in the comments after each relevant line

var fileName = "NursePurse.jobjson1.txt";
var assembly = typeof(pageJobs).GetTypeInfo().Assembly;
//assembly.base.CodeBase = "file:///storage/emulated/0/Android/data/NursePurse.Droid/files/.__override__/NursePurse.dll"

String fname = assembly.FullName;
//fname = NursePurse, Version=1.0.6504.22050, Culture=neutral, PublicKeyToken=null

Stream stream = assembly.GetManifestResourceStream(fileName);
List<String>  t = assembly.GetManifestResourceNames().ToList();
// there are two entries
// "NursePurse.AppResources.resources","NursePurse.jobjson1.txt"    
// here is my file! But I don't see neither of these files in the android device manager. 

Question – where is it?

Following is the screenshot of Android Dev.Manager View and Device definition with SIM card
enter image description here

Answers: