Share via


Path to "raw" folder in Android

Question

Monday, January 18, 2021 11:21 PM

Hello I want to get a list from all files (videos) in the raw folder for Android , but I keep getting , not found file

        Uri uri = new Uri("android.resource://ProjectName/raw/");

        string[] items = Directory.GetFiles(uri.AbsolutePath);

Can anybody help? thx in advance

All replies (3)

Tuesday, January 19, 2021 2:27 AM ✅Answered

To get the list of the files in the raw folder, try using the Type.GetFields method to get all the public fields of the Resource.Raw type.

Check the code: ``` List lists = new List();

var rawclass = typeof(Resource.Raw); var fields = rawclass.GetFields(); foreach (var item in fields) { lists.Add(item.Name); } ```


Xamarin forums are migrating to a new home on Microsoft Q&A! We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A! For more information, please refer to this sticky post.


Thursday, January 21, 2021 8:50 AM

@luiscarrero Hi, any updates? If you've solved the problem, please accept the helpful reply as the answer. It'll help others who face the similar problem. If you are facing some issues while implementing, try to post the particular error with the corresponding codes here.


Xamarin forums are migrating to a new home on Microsoft Q&A! We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A! For more information, please refer to this sticky post.


Thursday, January 21, 2021 11:52 AM

Yes thx you, works perfectly