12

I need the Java class's name in the Constructor for Android.Content.ComponentName as Xamarin doesn't have an overloaded constructor that takes typeof(ClrType) like it does for some other things.

lahsrah
  • 9,013
  • 5
  • 37
  • 67
  • Have you used `ComponentName.PackageName`? – Akash Amin May 24 '16 at 12:45
  • 1
    It turns out it isn't namespace. its Java class name or something. I was programmatically get it by doing this: ```Java.Lang.Class.FromType(typeof(MyClass)).Name``` – lahsrah May 24 '16 at 12:53
  • It shows the Namespace of your current class using `this.ComponenetName.PackageName`. Also for the class name `this.ComponentName.ClassName` I'm not sure where you want the namespace. – Akash Amin May 24 '16 at 12:56

1 Answers1

22

I was able to solve it by doing this: Java.Lang.Class.FromType(typeof(MyClass)).Name

lahsrah
  • 9,013
  • 5
  • 37
  • 67