Irshad Ali
Irshad Ali

Reputation: 1213

Xamarin Android equivalent "method", "property" or "class" of Android

What is used in xamarin android in place of android code. You may add your questions to this to make it more useful. Please answer if know equivalent the below method:

  1. getResources()
  2. getDisplayMetrics()
  3. stringWithContentsOfFile("ReadMe.txt")

Upvotes: 0

Views: 66

Answers (3)

thumbmunkeys
thumbmunkeys

Reputation: 20764

If you have a Context instance then you can do this:

  1. Context.Resources
  2. Context.Resources.DisplayMetrics;
  3. System.IO.File.ReadAllText(file);

Context can be obtained via Application.Context or an Activity instance

Upvotes: 2

Stephanvs
Stephanvs

Reputation: 731

When building your app with Xamarin.Android you actually use the exact same API's as you would normally if you develop for Android in Java. However, the API signatures have been C#-ified, to adhere to the naming conventions of the .NET platform. So the names are almost all the same, or equivalent in .NET as they are in Java.

Upvotes: 0

Irshad Ali
Irshad Ali

Reputation: 1213

Please add you answers in it.

Answer:

  1. System.IO.File.ReadAllText("ReadMe.txt");

Upvotes: 0

Related Questions