0

I am using a piece of code, that requires a path to a file to function. How can I get the raw path to the data on android? (Said data is currently in the Assets folder, but I can move it somewhere else.) Are there any workarounds?

void FunnyCode(string filePath);

FunnyCode(/*???*/);

1 Answers1

1

According to this case about How to get URI from an asset File, there is no "absolute path for a file existing in the asset folder". The content of your project's assets are packaged in the APK file.

And the resource folder should also be same as the asset folder. So you can try to use the AssetManager to copy the file to a local folder on the device. You can refer to this case about How to copy Asset folder content into internal storage in Xamarin.Android?

In addition, if you just want read the file. You can use the AssetManager.List() to get all the file in the Asset folder and AssetManager.Open() to read the file.

Liyun Zhang - MSFT
  • 8,271
  • 1
  • 2
  • 14