syntax1993
syntax1993

Reputation: 60

Xamarin.Forms Android content files

I'm trying to get Tess-Two (Tesseract OCR fork for Android) working using Xamarin.Forms but for my OCREngine to initialize, I need the path to the folder containing the language data. I've put this data into a folder and marked it as 'Content' with the 'Copy Always' option.

For some reason I can't seem to reference (or even find) the files I've marked as content.

Simply put: I need a folder with some files that need to be copied onto the device and I need to be able to get the path to them.

Upvotes: 0

Views: 1352

Answers (1)

Jason
Jason

Reputation: 89082

For Android, you want to include the files as Assets.

Android provides an AssetManager class that allows you to open and read Assets

string content;
using (StreamReader sr = new StreamReader (Assets.Open ("read_asset.txt")))
{
    content = sr.ReadToEnd ();
}

Upvotes: 1

Related Questions