Forum Cross Platform with Xamarin

How to read txt file on xamarin cross platform (IOS & ANDROID)

So i've had this problem for a bit

I am opening my txt file to text and it only will open on IOS not Android. It just shows an error when i try to open Android.

I put the txt file in the Resource Folder for both IOS and Android but Android won't open it still.

Heres the code for the filepaths:

string filePathq = "questions.txt";

List<string> questions = File.ReadAllLines(filePathq).ToList();

If you could help me with this it would be greatly appreciated

Best Answer

Answers

  • LeloLelo Member ✭✭✭

    But is this when accessing file from inside the library project. Not from the forms project?

  • LeloLelo Member ✭✭✭

    But is this when accessing file from inside the library project. Not from the forms project?

    CurrentClass has to be a class inside the library project. Missed that

Sign In or Register to comment.